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 09-13-2010, 05:06 PM   #1
howudodat
LQ Newbie
 
Registered: Sep 2010
Posts: 2

Rep: Reputation: 0
IP Route UDP and TCP packets different interfaces


I have 2 hdlc interfaces in my box both using RF links. One of the links is uni-directional, the other bi-directional. I want to send all TCP traffic through the bi-directional link and UDP traffic through the uni link. I've got source routing working through the two interfaces

Code:
ip route add 10.10.1.0 via 192.168.1.2 dev hdlc0 tab 1
ip route add 10.10.1.0 via 192.168.1.2 dev hdlc1 tab 2

ip rule add from 10.10.2.101/32 tab 1 priority 500
ip rule add from 10.10.2.102/32 tab 2 priority 600
However I'd like to have a rule that looks more like this:
Code:
ip rule add PROTO udp tab 1 priority 500
ip rule add PROTO tcp tab 2 priority 600
How would I go about doing something like this?

Peter
 
Old 09-14-2010, 07:51 AM   #2
hda7
Member
 
Registered: May 2009
Distribution: Debian wheezy
Posts: 244

Rep: Reputation: 31
Quote:
Originally Posted by howudodat View Post
I have 2 hdlc interfaces in my box both using RF links. One of the links is uni-directional, the other bi-directional. I want to send all TCP traffic through the bi-directional link and UDP traffic through the uni link. I've got source routing working through the two interfaces

Code:
ip route add 10.10.1.0 via 192.168.1.2 dev hdlc0 tab 1
ip route add 10.10.1.0 via 192.168.1.2 dev hdlc1 tab 2

ip rule add from 10.10.2.101/32 tab 1 priority 500
ip rule add from 10.10.2.102/32 tab 2 priority 600
However I'd like to have a rule that looks more like this:
Code:
ip rule add PROTO udp tab 1 priority 500
ip rule add PROTO tcp tab 2 priority 600
How would I go about doing something like this?

Peter
Take a look at iptables. It has a mechanism to match packets of specific protocols.
 
Old 09-22-2010, 05:14 PM   #3
howudodat
LQ Newbie
 
Registered: Sep 2010
Posts: 2

Original Poster
Rep: Reputation: 0
So in order to give a more useful reply to others who might be searching for a response:
Source routing can be performed by iptables, using the mangle table and the POSTROUTING chain. Typical entries would look like:
Code:
iptables 
    -A POSTROUTING    Chain to add rule to
    -t mangle         Table to add rule to
    -j ROUTE          Action we want to take
    --gw 10.1.1.1     Gateway to send the packet to
    -p tcp            match protocol tcp
    --dport 27000     match dest port 27000
Peter
 
  


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
Decode tcp/udp packets using ffmpeg tushs Linux - Desktop 2 05-25-2010 12:08 AM
UDP: Short Packets: and UDP bad checksum: entries in dmesg minutes2memories Linux - Networking 2 02-26-2006 07:28 PM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM
Only receiving UDP packets, no TCP erevlehdeux Linux - Networking 1 04-23-2004 07:36 PM


All times are GMT -5. The time now is 01:15 AM.

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