Find the answer to your Linux question:
Results 1 to 3 of 3
hello i need help with iptables, im trying to forward some ports to my windows machine and im still not able to make it work. Code: #!/bin/sh IPTABLES=/sbin/iptables #Enable forwarding ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2004
    Posts
    8

    NAT some ports to a windows machine


    hello i need help with iptables, im trying to forward some ports to my windows machine and im still not able to make it work.

    Code:
    #!/bin/sh
    
    
    IPTABLES=/sbin/iptables
    
    #Enable forwarding
    iptables -F
    iptables -t nat -F
    iptables -X
    
    echo "1" > /proc/sys/net/ipv4/ip_forward
    
    $IPTABLES -P INPUT ACCEPT
    $IPTABLES -F INPUT
    
    $IPTABLES -P OUTPUT ACCEPT
    $IPTABLES -F OUTPUT
    
    $IPTABLES -P FORWARD DROP
    $IPTABLES -F FORWARD
    $IPTABLES -t nat -F
    $IPTABLES -A FORWARD -i ppp0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPTABLES -A FORWARD -i eth0 -o ppp0 -j ACCEPT
    $IPTABLES -A FORWARD -j LOG
    
    $IPTABLES -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
    echo internet shering enabled
    
    iptables -t nat -A PREROUTING -p tcp --dport 6112 -j DNAT --to 192.168.0.2
    iptables -t nat -A PREROUTING -p udp --dport 6112 -j DNAT --to 192.168.0.2
    echo wc3 ports forwarded
    this is how my rc.firewall looks like now ... could you possable help me if you see somthing wrong in there or missing.

    Thx.

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    The switch for DNAT should be --to-destination.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Posts
    8
    yeah i know but that dose not work eather

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •