[CentOS] Routing of outgoing packets

Thu Sep 30 14:46:38 UTC 2010
Mitja Mihelič <mitja.mihelic at arnes.si>

  Hi!

I am trying to use hping to chek the latency of our network.
Somehow things are not going to plan and I thought someone might be able 
to shed some light on the subject.

Here is the setup:
(the IP addresses gvien here are fake, but they do represent the correct 
state of the networking setup)
vlan      interface      IP                      mask
V2        eth0           192.168.20.20    32
V4        eth1           172.16.4.40        32
V6        eth2           172.16.6.60        32

The default route is set to eth1.
The idea is to use eth2 for pinging only, the other two interfaces are 
used by another service and management access.

If I do:
ping -c 2 -I eth2 74.125.39.147
or
fping -c 2 -I eth2 74.125.39.147
It binds to eth2 and sends its ICMP probes via that interface with the 
IP on that interface.

If I do:
hping3 -1 -c 2 -I eth2 74.125.39.147 -VD
or
[root at server ~]# hping3 -c 2 -I eth2 74.125.39.147 -VD
DEBUG: if lo: Don't Match (but seems to be UP)
DEBUG: if eth0: Don't Match (but seems to be UP)
DEBUG: if eth1: Don't Match (but seems to be UP)
DEBUG: if eth2: OK
using eth2, addr: 172.16.6.60, MTU: 1500

It supposedly binds to eth2. But tcpdump tells another story.
Packets get sent out via the default route (eth1) with the IP from eth2 
set as the source address.

The same happens with tcptraceroute 
(tcptraceroute-1.5-0.beta7.el5.rf.i386.rpm).

I have tried various routing policies, but I have yet to find a solution 
that works.
I have used iptables to log the packets in the OUTPUT chain, but they 
arrive there with the interface already set to eth1.

Can anyone help ?

Regards,
Mitja Mihelic