I need help setting up a basic routing between two nic's on my CentOS desktop. I thought I'd understood the basics, but ... I don,t want a nat router, just packets forwarded back and fort.
This is what I thought would do the trick, but didn't. Can someone please give me some pointers or links so I can get this right.
# echo "1" > /proc/sys/net/ipv4/ip_forward # route add -net 192.168.2.0 netmask 255.255.255.0 eth1 # route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.150 eth1 # # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 192.168.1.150 255.255.255.0 UG 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1 0.0.0.0 192.168.1.150 0.0.0.0 UG 0 0 0 eth1
On Wed, 2006-08-16 at 14:39 +0200, centos wrote:
I need help setting up a basic routing between two nic's on my CentOS desktop. I thought I'd understood the basics, but ... I don,t want a nat router, just packets forwarded back and fort.
This is what I thought would do the trick, but didn't. Can someone please give me some pointers or links so I can get this right.
# echo "1" > /proc/sys/net/ipv4/ip_forward # route add -net 192.168.2.0 netmask 255.255.255.0 eth1 # route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.150 eth1 # # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 192.168.1.150 255.255.255.0 UG 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1 0.0.0.0 192.168.1.150 0.0.0.0 UG 0 0 0 eth1
2 nics hooked up on just 2 machines...gotta use a crossover cable..not a patch
that's bout it ummm if you are also gatewayed outsite...I'd suggest googling round for passwordless ssh for the two machines to packet back and forth on auto
off to work now
John
rado wrote:
On Wed, 2006-08-16 at 14:39 +0200, centos wrote:
I need help setting up a basic routing between two nic's on my CentOS desktop. I thought I'd understood the basics, but ... I don,t want a nat router, just packets forwarded back and fort.
This is what I thought would do the trick, but didn't. Can someone please give me some pointers or links so I can get this right.
# echo "1" > /proc/sys/net/ipv4/ip_forward # route add -net 192.168.2.0 netmask 255.255.255.0 eth1 # route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.150 eth1 # # route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 192.168.1.150 255.255.255.0 UG 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1 0.0.0.0 192.168.1.150 0.0.0.0 UG 0 0 0 eth1
2 nics hooked up on just 2 machines...gotta use a crossover cable..not a patch
that's bout it ummm if you are also gatewayed outsite...I'd suggest googling round for passwordless ssh for the two machines to packet back and forth on auto
off to work now
I think he's referring to two nics on the SAME computer. :)
Cheers,
By the way, if you just want to set up a simple bridge between two networks, I remember reading an article in Linux Journal last year sometime (fires up Google....here it is):
http://www.linuxjournal.com/article/8172
Maybe that will get things working for you.
Cheers,
Chris Mauritz wrote:
By the way, if you just want to set up a simple bridge between two networks, I remember reading an article in Linux Journal last year sometime (fires up Google....here it is):
Thank you for the link to the article, yes that's the funksion I'm looking for. But then, maybe a lame question, How to set up a router that just forward packets to next hop?
I have googled my self blue without anything.
Yes I have 2 nic,s on the same machine and using a crossed cable, so hooking up on each side works fine.
I need to hook up equipment on the one side to monitor packets used, and also I would like to use the CentOS as a router towards the wan with my new sangoma s518 card, but if I can't route between two simple nic's I feel stuck.
Thanks
On Wed, August 16, 2006 5:53 pm, kai wrote:
Chris Mauritz wrote:
By the way, if you just want to set up a simple bridge between two networks, I remember reading an article in Linux Journal last year sometime (fires up Google....here it is):
Thank you for the link to the article, yes that's the funksion I'm looking for. But then, maybe a lame question, How to set up a router that just forward packets to next hop?
I have googled my self blue without anything.
Yes I have 2 nic,s on the same machine and using a crossed cable, so hooking up on each side works fine.
I need to hook up equipment on the one side to monitor packets used, and also I would like to use the CentOS as a router towards the wan with my new sangoma s518 card, but if I can't route between two simple nic's I feel stuck.
Thanks
As root, you can enable ip forwarding between interfaces by executing
echo 1 > /proc/sys/net/ipv4/ip_forward
To make it permanent, set net.ipv4.ip_forward in /etc/sysctl.conf to "1":
net.ipv4.ip_forward = 1
Marko
On 8/16/06, kai centos@sandsengen.com wrote:
Chris Mauritz wrote:
By the way, if you just want to set up a simple bridge between two networks, I remember reading an article in Linux Journal last year sometime (fires up Google....here it is):
Thank you for the link to the article, yes that's the funksion I'm looking for. But then, maybe a lame question, How to set up a router that just forward packets to next hop?
I have googled my self blue without anything.
Yes I have 2 nic,s on the same machine and using a crossed cable, so hooking up on each side works fine.
I need to hook up equipment on the one side to monitor packets used, and also I would like to use the CentOS as a router towards the wan with my new sangoma s518 card, but if I can't route between two simple nic's I feel stuck.
From you original post: Is this OK?
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 IIUC this seems to be your remote network, behind 192.168.1.150 which is your gw. These routes claim that 192.168.2.0 is directly connected to your host --is it right?. If yes, I can hardly see any purpose in having both interfaces on the same IP subnetwork. I think you may want to further clarify your situation with a silly ASCII art diagram, and state how you are testing your setup.
I assume you are testing with ping. Are you sure the machines you want to reach really know the way back to the originating node so they are able to acknowledge your pings (i.e. do they know the route to 192.168.1.0/24)? Have you had a look at what really comes in and out the interfaces (with, say, tcpdump)? For instance # tcpdump -i eth 1 host 192.168.2.1 may show you something interesting when pinging 192.168.2.1.