PDA

View Full Version : Computer on 2 networks


link1305
06-05-06, 08:35 AM
I'm having a strange problem here at work; I have a sendmail server I'm configuring, and it has 2 network interfaces (running Fedora Core 5). The IP of eth0 is 10.1.0.229, and the IP of eth1 is 172.17.1.225. The 10.* network is the internal company network, and the 172.* network is for servers that are on the DMZ.

When this server connects to the internet I need to route it through the 172 network instead of the 10. network so it can do what it needs without the firewall interfering. I did this by modifying the routing table, something I had never really done before. I basically made the default gateway the 172. network instead of the 10. one which is was previously. Now, I can't SSH to this server through it's 10 IP address, but I can through the 172 address.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.1.0.0 * 255.255.255.0 U 0 0 0 eth0
172.17.1.0 * 255.255.255.0 U 0 0 0 eth1
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
default 172.17.1.1 0.0.0.0 UG 0 0 0 eth1


If I remove the 172 default route and add the 10 default route, I can SSH to it again through the 10 network. However when I do that I can't send mail any more from the server, because of the firewall (since it's using the 10. network). Interestingly, when the default route is 10, I can still talk to it on the 172 interface; Anyone know why it wont' let me talk to it (on the 10...) when I change the default route from 10. to 172.?

Thanks!

Cheator
06-05-06, 08:50 AM
as far as I can tell, its because you obviously have no 10.* gateway, so it doesn't know where the router is. Can you not add something like:

Destination: 10.1.0.0
Gateway: 10.1.0.1 (or wahtever it is)
Genmask: 0.0.0.0
and the rest is obvious. And then add that for 172 as well? I might not have direct experience with linux routing tables, but i do know it needs to know where to go. On cisco routers we did default routes, so i can't help all that much.

link1305
06-05-06, 01:17 PM
I don't think I can/need to enter gateways for those that are already in there. In all the examples I've seen online, there's been * under where the gateway would be.

I've tried to add 10.5.0.0 to the routing table, but for some reason it keeps adding the mask of 255.255.255.255 becuase it thinks it's a host (and not a network) If I add /24 to the end of it, it won't accept it. I also tried "route add -net 10.5.0.0" but it says bad argument :bang head

I just added the full IP of my computer to the route table, and now I can SSH to the box. I think I just need to add the 10.5 network to the routing table somehow.

link1305
06-06-06, 08:27 AM
If anyone is interested:

I was able to add the correct route using the Iproute2 package, which would let me do things the kernel routing table just wouldn't allowe. I followed this guide somewhat: http://www.linuxjournal.com/article/7291 and basically made 2 separate routing tables, one for each interface.