Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Networking > Policy Routing issue: packet exiting with wrong src IP address.

Forgot Password?
 Linux Networking   Hardware/Software related, Modems, Internet connection sharing, IPTables etc.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 07-25-2008   #1 (permalink)
Just Joined!
 
Join Date: Jul 2008
Posts: 1
Policy Routing issue: packet exiting with wrong src IP address.

I'm working on an application where we use IPtables and IProute2 to setup a situation (similar to a firewall), where we have setup multiple routing tables and have some rules that direct traffic to different interfaces depending on the port number.

It generally works well, but I've come across a strange situation. The routing tables are sending a packet to interface #2, but the source IP address in the packet is that of interface #1. I suspect that the application is binding to interface #1 and that the source IP is being set before the routing rules get the packet.

Two questions:
1) Is this a likely explanation (why or why not).
2) How can I tell if this is the case (I don't have the source to the app).

I know the rules are working, because if I take out the IPtables line for the port I'm using, the traffic goes out the bond2 port. If I put the rule in, the packet goes out bond1. Either way the packet has a source IP of 192.168.102.190!

Any info/ideas appreciated,
Brad

Here's some config information:
------------------------
Output from "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
------------------------
"iptables -L -n -t mangle":
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
MARK tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:21 MARK set 0x1
MARK udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:21 MARK set 0x1
MARK tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:22 MARK set 0x1
MARK udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:22 MARK set 0x1
MARK tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:23 MARK set 0x1
MARK udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:23 MARK set 0x1
MARK tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:162 MARK set 0x1
MARK udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:162 MARK set 0x1
-------------------------------
Output from "ip route show table 1":
192.168.102.0/24 dev bond2 scope link src 192.168.102.190
default via 192.168.102.6 dev bond2 src 192.168.102.190
------------------------------

Here's the weird thing. Here's a line from the output of "ip route show cache"
192.168.101.119 from 192.168.104.190 via 192.168.102.6 dev bond2
cache (null) 1500 ssthresh 1460 advmss 64

Note that the "from" address is not the same network as the "via" address.
-------------------------------
bsilva is offline  



Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
A Newbie's Getting Started Guide to Linux
Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.
subscribe
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 09:19 PM.






© 2000 - - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.1