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

Re: Multiple Network Gateways



Hallo Volkan,

I would like to setup a simple network detailed in the below schema.

[....]

I have the funny feeling you do not understand what the gateway statemeny in a interfaces file means.

reyiz# cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.10.98.100
       netmask 255.255.255.240
       network 10.10.98.96
       broadcast 10.10.98.111
       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
       gateway 192.168.100.98

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.

[.....]

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.

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.*

You also have some dns lines in that interfaces file. As far as I know that is not alowed and those lines should be in the /etc/resolv.conf file.

So your /etc/network/interfacec file should be:

----------<quote>-----------------------------
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
----------<quote>-----------------------------

And your /etc/resolv.conf file should be:
----------<quote>-----------------------------
nameserver 10.10.10.11
nameserver 10.10.10.12
domain ozun.int
search ozun.int
----------<quote>-----------------------------

This acomplishes what you want it to do.

Bonno



Reply to: