Re: Multiple Network Gateways
On 18/07/11 10:21, Volkan YAZICI wrote:
> [Before going with the rest of the reply, I'd like to thank who (lee,
> William Hopkins, Johannes Obermueller, Bonno Bloksma, Andrew McGlashan,
> Camaleón) sincerely answered to my question.]
> On Fri, 15 Jul 2011 23:31:05 +0200, "Bonno Bloksma" writes:
>> In here you have some duplicate information that is not needed. In the eth0
>> section the netmask 255.255.255.240 together with the ip-address of 10.10.98.100
>> automaticaly defines the network and broadcast address you give in the next
>> lines. You can leave them out.
> They are added by the Debian installer, not me. But yep, you are right.
>> A gateway statement means: send ANYTHING for which there is no specific route in
>> the routing table to this address which can be reached via this interface. There
>> is usualy just one gateway statement in the entire interfaces file unless one
>> wants to do multiple gateway routing, which is usualy done with the more
>> flexible and sophosticate ip statement.
>> So the gateway statement in the eth1 section is what causes the problem. You do
>> NOT want the gateway statement there as that is NOT the address to send all
>> unspecified traffic to, that is what you want the eth0 interface to use the
>> 10.10.98.110 address for.
>> The address and netmask statement together define which network is behind the
>> eth1 interface and which traffic should be send to the network behind that
>> interface. In this case that will automaticaly be all trafic for
>> 192.168.100.0/24, that is all trafic for 192.168.100.*
> So you mean that, via a configuration as follows
> --8<---------------cut here---------------start------------->8---
> auto lo
> iface lo inet loopback
> auto eth0
> iface eth0 inet static
> address 10.10.98.100
> netmask 255.255.255.240
> gateway 10.10.98.110
> dns-nameservers 10.10.10.11 10.10.10.12
> dns-search ozun.int
> auto eth1
> iface eth1 inet static
> address 192.168.100.100
> netmask 255.255.255.0
> --8<---------------cut here---------------end--------------->8---
> all of my 192.168.100.0/24 traffic will be routed through eth1. But the
> thing I don't understand here is that: Say I typed "ping 192.168.100.1".
> How will it know that it will need to use 192.168.100.98 as a gateway to
It does not.
iface eth1 inet static
tells the system that 192.168.100.1 is on the network connected to eth1.