Fedora Linux Support Community & Resources Center
  #1  
Old 6th November 2007, 05:28 PM
arrowheart Offline
Registered User
 
Join Date: Jun 2007
Posts: 21
IP packet forwarding

Let me tell you some background first.

I have four hosts, one is a gateway, or a hub, the other three are internal hosts. Each internal host has an IPSec host-to-host connection with the hub. By configuring IPsec connections and activating IP forwarding (echo "1" > /proc/sys/net/ipv4/ip_forward), all traffics between internal hosts must go through the hub. For example, if host1 wants to ping host2, ICMP request will be sent to the hub first, then the hub will forward it to host2; similarly, ICMP reply from host2 will go to the hub and be forwarded to host1 later. The procedure is transparent to all internal hosts.

The problem is that if I run a script on the hub to add some rules to iptables, the ip forwarding functionality mentioned above is disabled. If host1 pings host2, I can see ICMP requests are being sent to the hub, but the hub does not forward them to host2. The following is the script used to add rules:

-----------------------------------------------------------
EXT=eth1
INT=eth0

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

/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -F INPUT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -F OUTPUT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -F FORWARD
/sbin/iptables -t nat -F

/sbin/iptables -A PREROUTING -t nat -i $EXT -p tcp --dport 420 -j DNAT --to 192.168.1.20:443
/sbin/iptables -A FORWARD -i $EXT -p tcp --dport 443 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A PREROUTING -t nat -i $EXT -p tcp --dport 421 -j DNAT --to 192.168.1.21:443
/sbin/iptables -A FORWARD -i $EXT -p tcp --dport 443 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A PREROUTING -t nat -i $EXT -p tcp --dport 422 -j DNAT --to 192.168.1.22:443
/sbin/iptables -A FORWARD -i $EXT -p tcp --dport 443 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

#/sbin/iptables -A PREROUTING -t nat -i $EXT -p tcp --dport 45 -j DNAT --to 192.168.1.5:443
#/sbin/iptables -A FORWARD -i $EXT -p tcp --dport 442 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A PREROUTING -t nat -i $EXT -p tcp --dport 430 -j DNAT --to 192.168.1.20:80
/sbin/iptables -A FORWARD -i $EXT -p tcp --dport 80 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A FORWARD -i $EXT -o $INT -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i $INT -o $EXT -j ACCEPT
/sbin/iptables -A FORWARD -j LOG --log-prefix "FOWARD dropped "
/sbin/iptables -A FORWARD -j DROP

/sbin/iptables -t nat -A POSTROUTING -o $EXT -j MASQUERADE

-----------------------------------------------------------

Can anybody tell me what's wrong with the script and how I should change it?

Thanks a lot!
Reply With Quote
  #2  
Old 6th November 2007, 11:59 PM
arrowheart Offline
Registered User
 
Join Date: Jun 2007
Posts: 21
Ok, I got it. I need add one ACCEPT rule for FOWWARD chain in case of internal hosts.
Reply With Quote
Reply

Tags
forwarding, packet

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Packet Forwarding from eth0 to eth1 isn't working rajat123 Servers & Networking 0 7th May 2007 09:58 AM
port forwarding, not forwarding?!!! Stranger Servers & Networking 2 29th September 2005 07:53 AM
Iptables Packet forwarding/routing problem cyanid3 Security and Privacy 9 10th September 2005 03:21 AM
TCP - RST packet moshe Programming & Packaging 2 13th August 2005 11:55 AM
Turn on packet forwarding at boot time ascheucher Servers & Networking 2 25th July 2005 06:35 PM


Current GMT-time: 03:11 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat