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 127.0.0.1/8 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 137.248.9.13/27 scope link eth0
    inet 137.248.9.13/24 brd 137.248.9.255 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 192.168.1.18/25 brd 192.168.1.127 scope global eth1
    inet 137.248.1.53/24 brd 137.248.1.255 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
137.248.1.0/25 dev eth1  scope link
192.168.1.0/25 dev eth1  scope link
137.248.1.0/24 dev eth1  proto kernel  scope link  src 137.248.1.53
default via 192.168.1.126 dev eth1

master:~# ip route show table 2
137.248.9.0/27 dev eth0  scope link  src 137.248.9.13
default via 137.248.9.30 dev eth0  src 137.248.9.13

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

But it won't work. The vservers are configured like this
IPROOT="eth1:137.248.1.53"
IPROOTMASK=255.255.255.0
IPROOTBCAST=137.248.1.255
IPROOTDEV=eth1
ONBOOT=yes
S_HOSTNAME=rsf1
S_DOMAINNAME=none
S_NICE=
S_FLAGS="lock nproc"
ULIMIT="-H -u 1000"
S_CAPS="CAP_NET_RAW"

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.

  vcard.vcf
< 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?