[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Multiple Network Gateways



On 07/15/11 at 04:00pm, Volkan YAZICI wrote:
> Hi,
> 
> I would like to setup a simple network detailed in the below schema.
> 
> --8<---------------cut here---------------start------------->8---
> 
>    ,===========.               eth0   ,-------.
>   || internet  || <-----------------> | reyiz |
>    `==========='        10.10.98.100  `-------'
>                                          ^
>                                     eth1 | 192.168.100.100
>                                          |
>                                          |
>                                          |
>   ,-------.   eth3                       |
>   | pampa | <----------------------------+
>   `-------^   192.168.100.98
> 
> 
> reyiz# cat /etc/network/interfaces
> auto lo
> iface lo inet loopback
> 
> auto eth0
> iface eth0 inet static
>         gateway 10.10.98.110

results in a default gateway entry being added to eth0

> iface eth1 inet static
>         gateway 192.168.100.98

results in a default gateway entry being added to eth1
 
> reyiz# route -n
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> 10.10.98.96     0.0.0.0         255.255.255.240 U     0      0        0 eth0
> 192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth1
> 0.0.0.0         192.168.100.98  0.0.0.0         UG    0      0        0 eth1
> 0.0.0.0         10.10.98.110    0.0.0.0         UG    0      0        0 eth0
> 
> --8<---------------cut here---------------end--------------->8---
> 
> The problem here is that there exists two entries in the routing table
> for 0.0.0.0 network pointing to both eth0 and eth1. But I just want to
> have 192.168.100.0 network requests to be handled by eth1, the rest
> should be redirected to eth0. That is, the desired routing table is as
> follows.
> 
> --8<---------------cut here---------------start------------->8---
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> 10.10.98.96     0.0.0.0         255.255.255.240 U     0      0        0 eth0
> 192.168.100.0   192.168.100.98  255.255.255.0   U     0      0        0 eth1
> 0.0.0.0         10.10.98.110    0.0.0.0         UG    0      0        0 eth0
> --8<---------------cut here---------------end--------------->8---
> 
> How should I configure /etc/network/interfaces to have such a routing
> scheme?

Don't add a 'gateway' entry to any interface except the one your default
gateway is accessed through. Looks like eth0. Otherwise the rest of the routing
should be automatically configured by ifup.

-- 
Liam

Attachment: signature.asc
Description: Digital signature


Reply to: