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

Multiple Network Gateways



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


reyiz# ifconfig
eth0      Link encap:Ethernet  HWaddr 1c:6f:65:aa:78:8f
          inet addr:10.10.98.100  Bcast:10.10.98.111  Mask:255.255.255.240
          inet6 addr: fe80::1e6f:65ff:feaa:788f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:143 errors:0 dropped:0 overruns:0 frame:0
          TX packets:122 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15294 (14.9 KiB)  TX bytes:13676 (13.3 KiB)
          Interrupt:28 Base address:0xc000

eth1      Link encap:Ethernet  HWaddr 54:e6:fc:80:ca:a9
          inet addr:192.168.100.100  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::56e6:fcff:fe80:caa9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:240 (240.0 B)  TX bytes:3942 (3.8 KiB)
          Interrupt:19 Base address:0x4000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:336 (336.0 B)  TX bytes:336 (336.0 B)


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?

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.


Reply to: