LinuxQuestions.org
Visit Jeremy's Blog.
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 04-25-2008, 10:15 PM   #1
razza
LQ Newbie
 
Registered: Apr 2002
Posts: 4

Rep: Reputation: 0
multiple internet connections iproute2 UDP problems


I've got two internet connections at work.

I want to set it up so that services such as OpenVPN work from either internet connections. I've got it working for SSH, Apache etc.. anything that runs over TCP seems to be fine however UDP doesnt appear to work with the secondary internet connection.

For example I tried to get OpenVPN working it wont work unless in the openvpn configuration I change it to TCP. tcpdump shows the UDP packets making it on secondary interface:
tcpdump -i eth1
15:06:23.347614 IP myhomeip.1764 > MySecondaryWanGateway.1194: UDP, length 14

Here is my current routing script (I've substituted my actual IP's)

#!/bin/sh
IF1=eth0
IP1=MyPrimaryWanIP
P1=MyPrimaryWanGateway
P1_NET=MyPrimaryWanNetmask

#Secondary Internet Connection.
IF2=eth1
IP2=MySecondaryWanIP
P2=MySecondaryWanGateway
P2_NET=MySecondaryWanNetmask

#internal network
P0_NET=192.168.1.0/24
IF0=eth3


ip route add $P1_NET dev $IF1 src $IP1 table T1
ip route add default via $P1 table T1
ip route add $P2_NET dev $IF2 src $IP2 table T2
ip route add default via $P2 table T2

ip route add $P1_NET dev $IF1 src $IP1
ip route add $P2_NET dev $IF2 src $IP2

ip route add default via $P1
ip rule add from $IP1 table T1
ip rule add from $IP2 table T2

ip route add $P0_NET dev $IF0 table T1
ip route add $P2_NET dev $IF2 table T1
ip route add 127.0.0.0/8 dev lo table T1
ip route add $P0_NET dev $IF0 table T2
ip route add $P1_NET dev $IF1 table T2
ip route add 127.0.0.0/8 dev lo table T2

#used to route out the Secondary nic with iptables connmark
ip rule add fwmark 0x4 lookup T2

Does anyone have any ideas?

My primary connection is 10meg fibre, the secondary is DSL the fibre connection I use iptables SNAT, on the secondary I dont do any NAT as the DSL router provides NAT everything passes through unhindered by the router to the linux box in a DMZ.
 
Old 04-27-2008, 07:29 AM   #2
houkouonchi
LQ Newbie
 
Registered: Nov 2005
Location: Corona, CA
Posts: 12

Rep: Reputation: 0
My setup on my server box is 1 connection as the default unless a program specifically binds to the second interface. Here is the ip route rules I use which work fine (for both UDP and TCP for me):

Code:
ip0=`ifconfig eth0  | grep inet\ ad | gawk '{print $2}' | cut -d':' -f2`
ip1=`ifconfig eth1  | grep inet\ ad | gawk '{print $2}' | cut -d':' -f2`
sub0=`ifconfig eth0  | grep inet\ ad | gawk '{print $2}' | cut -d':' -f2 | cut -d'.' -f1-3`
sub1=`ifconfig eth1  | grep inet\ ad | gawk '{print $2}' | cut -d':' -f2 | cut -d'.' -f1-3`
gw0=`echo $sub0.1`
gw1=`echo $sub1.1`

ip route del default dev eth0
ip route del default dev eth1

ip route del table 1
ip route add table 1 to default via $gw0 dev eth0

ip route del table 2
ip route add table 2 to default via $gw1 dev eth1

ip rule add from $ip0 table 1
ip rule add from $ip1 table 2

ip route add default via $gw0 dev eth0
 
  


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 with multiple internet connections sammythesquib Linux - Networking 2 06-05-2007 07:34 AM
Routing Multiple Internet Connections qwertyjoe Linux - Networking 2 11-25-2006 06:24 AM
Help for a newbie about multiple internet connections lazza79 Linux - Networking 0 01-03-2005 04:24 AM
Multiple internet connections kojie Linux - Networking 2 12-08-2004 03:19 PM
Multiple Internet connections (Broadband and Dial up) MadLee Linux - Hardware 0 04-11-2003 05:54 PM

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

All times are GMT -5. The time now is 04:36 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