How to use second routing table?

How to use second routing table?

Post by Martin Paul » Thu, 10 Mar 2005 02:54:34

Hi everyone,

I'm working on the following setup:
- 1 Linux box with Kernel 2.4.26-vs1.27
- 2 Ethernet-NICs, each one connected to a different VLAN (and hence, to
different sets of IP subnets)
- by means of vservers, the whole thing should behave like two seperate
machines, each one offering public service via its own VLAN/subnet

So I have 3 'Linuxes' running: the master, and 2 vservers,
They need 3 IP addresses; I chose them to come from
3 different subnets like this:

master:~# ip addr show
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0e:0c:5c:53:75 brd ff:ff:ff:ff:ff:ff
    inet scope link eth0
    inet brd scope global eth0:rst1
3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0e:0c:5c:53:74 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth1
    inet brd scope global eth1:rsf1

The private address is used to administer the master, rsf1 and rst1 are, of
course, the vservers.

Now, since all routing is done in the common network stack of the master,
I have to make a source based routing decision there, i.e. make vserver rsf1
send its packets exclusively on dev eth1, and rst1 only on eth0.
So I set up 2 routing tables, the main one for master and vserver rsf1
(eth1), and a second one for vserver rst1 (eth0):

master:~# ip route show table main dev eth1  scope link dev eth1  scope link dev eth1  proto kernel  scope link  src
default via dev eth1

master:~# ip route show table 2 dev eth0  scope link  src
default via dev eth0  src

Next I add the decision rule, ending up with:
master22:~# ip rule show
0:      from all lookup local
32765:  from lookup 2
32766:  from all lookup main
32767:  from all lookup default

But it won't work. The vservers are configured like this
S_FLAGS="lock nproc"
ULIMIT="-H -u 1000"

so I can, e.g. ping from inside a vserver.
Fro rsf1, things work fine, but if I try from rst1,
tcpdump -i eth0
does not show a single packet leaving the machine
on this interface. Instead, everything looks like routing
tabel 2 is never even touched (pings go out on eth0,
carrying the source address of the master).

So what on earth is wrong with the above setup?
Cheers, Martin

  Dr. Martin Pauly     Fax:    49-6421-28-26994            
  HRZ Univ. Marburg    Phone:  49-6421-28-23527

  D-35032 Marburg                                                          


1. How Do Routing Table Entries Get Added to Routing Table at Bootup?

I have, what I think, is a simple question for the TCP/IP guys out there
who are familar with routing tables on AIX 4.1.5/4.2.1 in an IBM SP
environment. Or maybe not.

I have recently noticed that when I execute a 'netstat -r' on a
particular node in the SP environment, there are routing table entries
that I know I didn't put in there. I have to delete these "unwelcomed"
entries and re-add the correct ones. This is undesireable and maybe a
quick crash course in routing tables is justified. These unwelcomed
routing table entries seem to be automatically added right after I have
IPL'ed the node in question.

How did these routing table entries get added in the routing table? Does
anybody know the process?

Thank you in advance for your responses.

< 1K Download

2. XDM:how to stop it?

3. route insists on using dns, ifconfig on modifying the routing table... please help me!

4. AHA-2940 UW- Please help a Newbie!

5. two gateways in routing table?

6. Limiting individual process table sizes?

7. Two default gw in kernel routing table

8. Pop up a dialog box from a shell script?

9. problem with iproute2 & second routing table (2.2.x)

10. Routing Table Entrys disappear with Second E-net Card

11. How to setup routing table for two NICS

12. How to set up routing table or gateway tables for ppp?

13. How can I read two tables of different size using awk?