Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-17-2014, 07:52 AM
|
#1
|
LQ Newbie
Registered: Feb 2014
Posts: 12
Rep:
|
centos as router problem
hello, I need your help please
I have centos 6.5 server with two NICs cards to work as a router without nat
first eth0 is connected to a router1 with subnet 10.10.10.0/30 (centos has 10.10.10.2 IP and the router has 10.10.10.1 IP)
second eth1 is connected to another router2 with public subnet for example 8.8.8.0/30 (centos has IP 8.8.8.2 and router IP 8.8.8.1)
I have configured the default gateway to be 8.8.8.1
I have enabled IPV4 forwarding
router1 can ping to 8.8.8.1 through the server successfully, the traffic get forwarded from eth0 (10.10.10.2) to eth1 (8.8.8.2) and back successfully
now if there is a client behind router1 wants to reach hotmail.com for example lets assume client ip is 1.1.1.1 wants to reach 2.2.2.2, the communication should be as follow
1- router1 will handle the traffic to server eth0
2- eth0 will forward the traffic to eth1 (because there is only one route which is the default gateway to 8.8.8.1)
3- eth1 will forward the traffic to router2 8.8.8.1
4- router2 will return the answer to the client but through another route not through the server
I had centos 5.3 and it worked properly with this design, when i issue tcpdump -i eth0 i see the traffic from the client (EX 1.1.1.1.port > 2.2.2.2.port)
also tcpdum -i eth1 show the same traffic (EX 1.1.1.1.port > 2.2.2.2.port)
also iptables -nL -v show the forwarding chain packet count increase
now the new server Centos 6.5 does not do the same I see the traffic enters the server on eth0(10.10.10.2) with tcpdump -i eth0, but I can't see it forwarded to eth1 (8.8.8.2) with tcpdump -i eth1, and also iptables doesn't show increase in the forwarding chain packet count, why is this happening?
PLease any help because this issue is driving me crazy, am i missing something or what?!!
sorry for my long post.
|
|
|
02-17-2014, 08:35 AM
|
#2
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
Have you enabled forwarding? You can check by "cat /proc/sys/net/ipv4/ip_forward", and it should have a "1" value.
You can do it temporarily for testing by "echo 1 /proc/sys/net/ipv4/ip_forward", though this will only last until the next reboot.
A permanent setting (as in, set at each boot) by editing /etc/sysctl.conf and set "net.ipv4.ip_forward = 1".
|
|
|
02-17-2014, 11:32 AM
|
#3
|
LQ Newbie
Registered: Feb 2014
Posts: 12
Original Poster
Rep:
|
thanks yes forwarding is enabled, i made sure it is enabled by
router1 can ping to 8.8.8.1 through the server successfully, the traffic get forwarded from eth0 (10.10.10.2) to eth1 (8.8.8.2) and back successfully
if the forwarding is not enabled router1 can not reach 8.8.8.1
|
|
|
02-18-2014, 10:11 AM
|
#4
|
Member
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108
Rep:
|
Can you try Reverse Path Forwarding (RPF) filtering in loose mode?
Code:
echo 2 > /proc/sys/net/ipv4/conf/default/rp_filter
echo 2 > /proc/sys/net/ipv4/conf/all/rp_filter
If it is working, you should configure at /etc/sysctl.conf
Code:
net.ipv4.conf.default.rp_filter = 2
|
|
1 members found this post helpful.
|
02-22-2014, 08:09 AM
|
#5
|
LQ Newbie
Registered: Feb 2014
Posts: 12
Original Poster
Rep:
|
Thank you very much, this solved the problem and also this is the difference between centos 5 and centos 5 the extra boolean of Reverse Path Forwarding in loose mode 2 as described here: https://access.redhat.com/site/solutions/53031
Thanks again
|
|
|
All times are GMT -5. The time now is 10:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|