LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-17-2014, 06:52 AM   #1
amr.es
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Rep: Reputation: Disabled
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.
 
Old 02-17-2014, 07:35 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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".
 
Old 02-17-2014, 10:32 AM   #3
amr.es
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-18-2014, 09:11 AM   #4
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
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.
Old 02-22-2014, 07:09 AM   #5
amr.es
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] CentOS 6.4 Router - Routes one way only! networkexperiment Linux - Networking 2 07-25-2013 01:45 PM
Configuring CentOS as a router DK907 Linux - Networking 4 05-16-2013 01:54 PM
[SOLVED] CentOS 5.8 NAT router icmp unreachable admin prohibited problem kenneth_phough Linux - Networking 6 08-09-2012 08:14 AM
CentOS VLANs and Cisco Catalyst switch (router on stick problem) Grejeru Linux - Networking 4 07-28-2011 02:08 PM
centOS 5 and router problems littlebitlost Linux - Server 4 04-04-2009 12:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration