Hi,


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?

1) To get rid of the second default route, your /etc/network/interfaces should like this:

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


so you just have to remove the following line:
         gateway 192.168.100.98

then you should get:

--8<---------------cut here---------------start------------->8---
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         10.10.98.110    0.0.0.0         UG    0      0        0 eth0
--8<---------------cut here---------------end--------------->8---


2) As lee already wrote, it seems a bit strange that you want to use 192.168.100.98 as gateway to the 192.168.100.0 network. AFAIK you have to do it in a startup script or manually (as you did), I don't know of any way to specify this in your /etc/network/interfaces file.

The man page of route says the following:

gw GW route packets via a gateway. NOTE: The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. If you specify the address of one of your local interfaces, it will be used to decide about the interface to which the packets should be routed to. This is a BSDism compatibility hack.

The problem is, that with your current routing table:
> 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 > 0.0.0.0 10.10.98.110 0.0.0.0 UG 0 0 0 eth0
> --8<---------------cut here---------------end--------------->8---

you don't have a static route to the 192.168.100.98, therefore it gives you the error message. So what you have to do is to set up a static route to 192.168.100.98 first and then add your route to 192.168.100.0 that goes through 192.168.100.98. That should work.

Anyway, why exactly do you want to route the packets to 192.168.100.0 through 192.168.100.98?

Moreover, I tried to create such a routing scheme manually. First, I
removed the eth1 entries:

--8<---------------cut here---------------start------------->8---
reyiz# route del -net 192.168.100.0 netmask 255.255.255.0 dev 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
0.0.0.0         10.10.98.110    0.0.0.0         UG    0      0        0 eth0
--8<---------------cut here---------------end--------------->8---

So far, so good. But I couldn't add a new routing entry for eth1. That
is,

--8<---------------cut here---------------start------------->8---
reyiz# route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.100.98
SIOCADDRT: No such process
--8<---------------cut here---------------end--------------->8---

I will be really appreciated for any help.


Best.



PS: sry for the bad formatting


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4e206ff9.6080...@gmx.at

Reply via email to