Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 08-25-2008, 06:04 PM   #1
LQ Newbie
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
Linux policy routing issue (am I tripping over a kernel bug?)

I'm having an unusual problem with a Policy Routing setup. I have a
combination of IPtables and Policy Routing rules that force certain
protocols out one interface and other protocols out the other interface.
The problem is that SNMP traps are exiting the correct interface, but
with the IP address of the other interface!

Furthermore, the situation only occurs if the destination is not local.
If the destination is local, the packet exits the correct interface with
the correct source IP. If the destination is via a gateway, then the
packet exits via the correct interface, but with the wrong source IP.

I'm at a loss. The rules and routes all appear to work correctly, it's
just the final assignment of the source IP that seems to be wrong. It
appears to me that I've found a bug in the kernel, but I'm not sure. Any
clues or further things to look at would be very helpful.

Thanks in advance,


I'm running kernel on a custom distribution.

Here's the route rules and route tables: (I've simplified the setup for
this problem)

$ iptables -L -t mangle
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
MARK tcp -- anywhere anywhere tcp dpt:162
MARK set 0x1

$ ip rule list
0: from all lookup 255
2000: from all fwmark 0x1 lookup 1
32766: from all lookup main
32767: from all lookup default

(I know that route table 1 is being selected since I can change these
routes and the result changes as expected)
$ ip route list table 1 dev bond2 scope link src
default via dev bond2 src

(note that even though the route specifies a "src" and
the cache entry shows the correct "via" address, the "from" address is!)
$ ip route list cache
.... from via dev bond2
cache (null) 1500 ssthresh 1460 advmss 64
Old 08-28-2008, 06:05 AM   #2
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
have you tried flushing the cache
ip ro fl ca


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
policy rule routing problem - help me pandanvn Linux - Networking 3 04-02-2007 07:24 PM
Policy routing using marks Xeta Linux - Networking 0 05-24-2006 07:22 PM
router issue - kernel routing tables? FliesLikeABrick Linux - Networking 2 11-02-2005 09:21 PM
help with policy based routing GaijinPunch Linux - Networking 4 06-19-2005 07:35 PM
[help] RH Network Routing Policy princenux Linux - Networking 1 07-04-2004 11:34 AM

All times are GMT -5. The time now is 01:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration