LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 08-16-2004, 10:14 AM   #1
Solemn Phoenix
LQ Newbie
 
Registered: Aug 2004
Location: UK
Distribution: Mandrake
Posts: 3

Rep: Reputation: 0
Kernel programming - rerouting packets to a specific interface


Using a box with two interfaces (namely, one of them being a wireless interface) with each one connected to a different physical network.

Identifying applications locally running on the box by their source port, I want to route the packets from specific applications through one or the other interface.

The idea is that
- using a ruleset, each (or some) applications are routed through the non-default interface from the moment they start
- when the default (eth0) interface goes down, the specific applications are routed through the other interface

While, hopefully, keeping the applications' connection live.

yeah, I know things look grim.

My best guess is that it's gonna have to be a new custom filter for netfilter, but I dont know what I *could* do with that.

Any help is appreciated
 
Old 08-16-2004, 11:38 AM   #2
bastard23
Member
 
Registered: Mar 2003
Distribution: Debian
Posts: 275

Rep: Reputation: 30
Just some quick thoughts:

Use a third IP (virtual) address on both interfaces, if one goes down, packets can go on the other device (assuming your other device has a route). This needs some work.
iptables can already match on source port and user, wouldn't that be enough?
You could create a tunnel between the two devices.
Try searching for "TCP session mobility" (which would allow IP addresses to change, hopefully). I do remember seeing a program that proxied all the connections, so you could do this. It was a while ago, and can't quickly find it on google or in my bookmarks.
http://www.hpl.hp.com/personal/Jean_...ileIP/mip.html for "mobile IP" never tried it myself, but maybe you'll find something.

Anyways, post back with what you find out.

Good Luck,
chris
 
Old 08-16-2004, 12:15 PM   #3
Solemn Phoenix
LQ Newbie
 
Registered: Aug 2004
Location: UK
Distribution: Mandrake
Posts: 3

Original Poster
Rep: Reputation: 0
thanx, I'm looking into the material...

one of the things I'm pretty certain that need to be done so far is that I need a module that has knowledge of the ruleset, makes a Netfilter hook so as to receive packets (which one of the 5?) , checks for specific source port(s) and then forwards it to the appropriate interface.

a) the 5 hooks are:

NF_IP_PRE_ROUTING Called after sanity checks, before routing decisions.
NF_IP_LOCAL_IN Called after routing decisions if packet is for this host.
NF_IP_FORWARD Called if the packet is destined for another interface.
NF_IP_LOCAL_OUT Called for packets coming from local processes on their way out.
NF_IP_POST_ROUTING Called just before outbound packets "hit the wire".

which one should I be using? The NF_IP_FORWARD looks mighty hopeful, but I'm still looking at where *exactly* in the stack it takes place.

This method goes for "tunneling" between the two devices...

b) Am I forgetting/ommiting something?

Last edited by Solemn Phoenix; 08-16-2004 at 12:20 PM.
 
  


Reply


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
drop packets for specific port with iptables ohcarol Linux - Security 1 07-03-2005 10:48 AM
how can i use libpcap to capture packets for the local loopback interface (lo) ? gajaykrishnan Programming 0 02-22-2005 04:03 AM
Is it possible to log packets in/out of a specific port? jon_k Linux - Software 5 08-12-2004 06:07 AM
packets being dropped by server from specific ip address alex_fittyfives Linux - Networking 1 08-04-2004 08:14 AM
How to send icmp packets on a particular interface? dravya Programming 3 07-29-2004 04:15 PM


All times are GMT -5. The time now is 07:40 PM.

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