Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables question

Reply
Thread Tools Display Modes

iptables question

 
 
adam
Guest
Posts: n/a

 
      07-13-2005, 07:05 PM
Hello, I'm writing some iptable rules that will allow 2 internal
subnets to be NAT'ed to one IP. I also want to be able to
directly access these boxes on this internal LAN to be directly
reachable by their internal IP's. The following rules don't seem
to get the job done:

iptables -t nat -A POSTROUTING -o eth1 -s 172.31.7.0/24 -j SNAT
--to-source 216.xxx.xxx.17
iptables -t nat -A POSTROUTING -o eth1 -s 172.31.8.0/24 -j SNAT
--to-source 216.xxx.xxx.17
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

eth0 is the internal interface and eth1 is the external. The problem
is these rules arn't working, and I'm not sure why. I can't get any
of the hosts behind the NAT to ping the next hop router. Can anybody
see anything wrong?
 
Reply With Quote
 
 
 
 
Eric Teuber
Guest
Posts: n/a

 
      07-13-2005, 07:14 PM
adam wrote:
> Hello, I'm writing some iptable rules that will allow 2 internal
> subnets to be NAT'ed to one IP. I also want to be able to
> directly access these boxes on this internal LAN to be directly
> reachable by their internal IP's. The following rules don't seem
> to get the job done:
>
> iptables -t nat -A POSTROUTING -o eth1 -s 172.31.7.0/24 -j SNAT
> --to-source 216.xxx.xxx.17
> iptables -t nat -A POSTROUTING -o eth1 -s 172.31.8.0/24 -j SNAT
> --to-source 216.xxx.xxx.17
> iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
> iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
>
> eth0 is the internal interface and eth1 is the external. The problem
> is these rules arn't working, and I'm not sure why. I can't get any
> of the hosts behind the NAT to ping the next hop router. Can anybody
> see anything wrong?


echo "1" > /proc/sys/net/ipv4/ip_forward

you better use this

iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED
-j ACCEPT

Eric
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables question Coenraad Loubser Linux Networking 2 03-11-2005 04:36 PM
iptables question. Gabolander Linux Networking 0 10-06-2003 06:59 PM
iptables question.... sam Linux Networking 0 09-22-2003 03:27 PM
Iptables question.. ishwar Linux Networking 1 07-17-2003 03:11 PM
IPTables question kza@wah.ath.cx Linux Networking 1 07-09-2003 04:34 AM



1 2 3 4 5 6 7 8 9 10 11