iproute2 and policy routing

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

 



Hello,

The configuration:
* A host with 2 slip interfaces, sl0 = 192.168.16.130 and sl1 = 
192.168.32.131. 
* Some locally generated packets are marked with iptables:
iptables -t mangle -A OUTPUT -p udp --dport 12345 -j MARK --set-mark 0x1
...
* I have setup routing tables and rules so that marked packets are routed 
according to custom tables:
$IP route add table 101 192.168.0.0/16 src 192.168.32.131 dev sl1
...
$IP route add table 102 192.168.0.0/16 src 192.168.16.130 dev sl0
...
$IP route add table 103 192.168.0.0/16 src 192.168.16.130 dev sl0
...
$IP route add 192.168.0.0/16 dev sl0
...
$IP rule add fwmark 1 table 101 priority 101
$IP rule add fwmark 2 table 102 priority 102
$IP rule add fwmark 3 table 103 priority 103
$IP route flush cache
* Both interfaces have a "qdisc prio" attached to them.

The problem:
The packets are marked and routed according to the correct table, but the 
source address is incorrect. For example packets with fwmark 1 go through 
sl1, but the source address is 192.168.16.130, which belongs to sl0.

It seems that the "src 192.168...." option in the custom tables (101, 102, 
and 103) does not have any effect, but that the source address is picked 
according to table main. If I change the route to 192.168.0.0/16 in table 
main to point to dev sl1, all packets get the source address of dev sl1.

Does anyone have an idea why my setup does not work as it should?


Thanks,

Sami Pönkänen
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux