[NBLUG/talk] Interface Aliases

Mansur, Warren warren.mansur at hp.com
Fri Apr 9 14:52:33 PDT 2004


> You were right about the multiple gateway entries. I removed 
> the one from
> the interface and it whent on blazing away. However I wonder about
> defining two gateways with the two routers. I'll have to experiment.
> 
> However it still doesn't seem to be working correctly. I can reach the
> webserver on the 192.168.33.0 network, but the router doesn't 
> seem to be
> port forwarding correctly. I'm sure I had that working at one 
> point, but
> this is not a linux issue but a router issue. Perhaps I 
> should re-install
> the OS on the router.

Oh silly me. I didn't see this the first time but now I see the routing table isn't correct.

> 192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
> 192.168.33.0    *               255.255.255.0   U     0      0        0 eth0
> 127.0.0.0       *               255.0.0.0       U     0      0        0 lo
> default         192.168.0.254   0.0.0.0         UG    0      0        0 eth0

12345678901234567890123456789012345678901234567890123456789012345678901234567890

Now what this is going to do is tell "if you have any address in network 192.168.0, send it out eth0 and assume the host is directly reachable out eth0. if you have any address in network 192.168.33, do the same thing".

Of course this will fail because the host isn't reachable directly off of eth0. It must be forwarded through the correct gateway.

What you want it do to is force it to send to the correct gateway instead of directly sending out on eth0. So you'll need something like this:

remove entries for 192.168.0.0 and 192.168.33.0, then add the following entries:

(1) route add -host 192.168.0.254 dev eth0
(2) route add -host 192.168.33.xxx dev eth0:0 (replace 'xxx' with actual 
                                              gateway address)
(3) route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.254
(4) route add -net 192.168.33.0 netmask 255.255.255.0 gw 192.168.33.xxx

#1 and #2 tell your node how to reach the respective gateways (via eth0 and eth0:0). Even though for both cases the routing table will display 'eth0', it matters that you specify the ":0" for the second gateway because that determines the source address sent out from your node.
#3 and #4 add the routes for each network, forcing traffic destined for each network to go to the specific gateway.

This way, traffic destined for 192.168.0.* will go to gateway 192.168.0.254, and the traffic destined for 192.168.33.* will go to gateway 192.168.33.xxx (where xxx is the other gateway).

Once you've set your routing table correctly, try the command 'traceroute' to some address in each subnet, and you'll be able to clearly see if it is being routed through the correct gateway.

For example, if you see:

% traceroute 192.168.0.23
 1  192.168.0.254  ...
 2  192.168.0.23 ...

Then that address is being routed correctly. Vice-versa for the other network. If an address in both networks goes to the same gateway or no gateway at all, then there is a configuration problem.

Regards,

Warren




More information about the talk mailing list