LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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-20-2009, 02:12 PM   #1
volivier
LQ Newbie
 
Registered: Sep 2009
Location: Montreal, Canada
Posts: 1

Rep: Reputation: 0
Dual WAN Destination-based Routing


Hi,

We are running Centos 5. We recently added an additional broadband cable connection to one machine, which is both a Web server and a VoIP Telephony PBX. We want to have all the VoIP (SIP) traffic go through that connection (eth1). The web server on that same machine would continue to use the old, default connection (eth2). So, in short, the machine has 2 ethernet interfaces each connected to a different ISP connection.

I made a lot of research in order to have all the SIP traffic to our DID and termination provider go through the new connection (eth1). I gathered that I should use the iptables and ip commands for that. Here are the commands I tried, where %NEW_IP% is the new connection static IP address, %NEW_GATEWAY% is the IP address of the new connection gateway and %VOIP_PROVIDER% is the IP address of the VoIP SIP provider.

Code:
ip route flush table 1
ip route show table main | grep -Ev ^default \
	| while read ROUTE ; do
	ip route add table 1 $ROUTE
done
ip route add table 1 default via %NEW_GATEWAY%
ip rule add fwmark 1 table 1
ip route flush cache

iptables -t mangle -A PREROUTING -d %VOIP_PROVIDER% -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -d %VOIP_PROVIDER% -j CONNMARK --save-mark
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source %NEW_IP%

So everything seems right to me there, but traceroute shows that the traffic is still routed through the old connection. Here is the traceroute dump where %OLD_GATEWAY% is the old connection's gateway (all other placeholders from previous code excerpt apply here) :


Code:
root@pbx:~ $ traceroute %VOIP_PROVIDER%
traceroute to %VOIP_PROVIDER%, 30 hops max, 40 byte packets
 1  % OLD_GATEWAY%  0.940 ms  1.316 ms  1.580 ms
 2  10.6.48.1 (10.6.48.1)  5.395 ms  8.302 ms  8.296 ms
 3  10.170.161.22 (10.170.161.22)  8.305 ms  8.293 ms  8.338 ms
 4  216.113.123.117 (216.113.123.117)  8.680 ms  8.672 ms  8.678 ms
 5  216.113.123.18 (216.113.123.18)  8.672 ms  9.669 ms  9.695 ms
 6  te6-1.cl-core04.vtl.mtl.iweb.com (207.253.238.114)  16.376 ms  12.805 ms  15.364 ms
 7  %VOIP_PROVIDER%  15.752 ms  19.707 ms  23.030 ms

I was wondering if anyone ever attempted something similar. If so, is it possible to show me where I did wrong?

Thanks,

Vincent
 
Old 10-01-2009, 01:54 PM   #2
brent999
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 0
more info

Suggest you post the results of:

netstat -rn
ip route
ifconfig

There may be there system tasks affecting the routing you are attempting to provide.
 
  


Reply



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
Routing based on destination port rvo Linux - Networking 9 01-11-2011 09:48 AM
Iptables / routing to destination address through interface Xeta Linux - Networking 7 05-10-2006 03:17 PM
How to routing same destination and ..... help ERBRMN Linux - Networking 2 02-23-2006 07:32 PM
Advanced routing across multiple WAN links ? michaelsanford Linux - Networking 1 06-28-2005 09:23 PM
Wan PCI Card T1 Routing in Linux dbeltz Linux - Networking 1 04-19-2004 09:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:46 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration