LinuxQuestions.org
Review your favorite Linux distribution.
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 03-18-2011, 01:10 PM   #1
hcjehg
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
2 ISP's, no fancy routing - yet


Hello All

I have a simple question I think

I have two ADSL lines connected to two different interfaces. One is connected directly to the ADSL router(in bridge mode) on a 192.168.0 network, the other one through all kinds of router equipment on a 172.16 network.

Here are the device network files:

[root@abcd ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=172.16.1.101
NETMASK=255.255.0.0
GATEWAY=172.16.1.1
ONBOOT=yes
METRIC=5
MII_NOT_SUPPORTED=no
USERCTL=no
DNS1=172.16.1.10
RESOLV_MODS=no
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=no

and


[root@abcd ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.0.0
GATEWAY=192.168.0.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no
RESOLV_MODS=no
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=no

Routing table

[root@abcd ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.0.0 0.0.0.0 255.255.0.0 U 5 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 5 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 10 0 0 eth1
192.168.0.0 0.0.0.0 255.255.0.0 U 10 0 0 eth1
0.0.0.0 172.16.1.1 0.0.0.0 UG 5 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 10 0 0 eth1

Now when I have both networks up I can do

ssh 80.90.100.200 <- invented ip to demonstrate problem without dns :-)

it works

I can do

ssh 80.90.100.200 -b 172.16.1.101

and it works

but this does not work (connection times out)

ssh 80.90.100.200 -b 192.168.0.2

If i do ifdown on eth0, then the above works.

Also incomming connections on eth1 only work when eth0 is down

If I do nothing it will use the lowest metric route through eth0 and that works and I am happy with that, but I would like to be able to connect specifically through the other connection...

Now for the question. What do I need to do to be able to make outgoing connections bound to either one of the external interfaces?(and thereby on the corresponding ADSL line)

Any help appreciated :-)

There is a shorewall in use, but it should be open for all outgoing connections, and the problem is the same when shorewall is off.

This is on Mandriva 2010.0 in i686 64bit

HC
 
Old 03-24-2011, 09:26 AM   #2
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
You need to use the "ip rule" command to select a different routing table based on the source address; the Advanced Routing HOWTO contains an example for a similar setup.
 
Old 03-25-2011, 10:53 PM   #3
b1r2s
LQ Newbie
 
Registered: Feb 2011
Posts: 11

Rep: Reputation: 0
Yes you'll need route and rule files for both interfaces (route-eth0, route-eth1, rule-eth0 and rule-eth1). These files will need to be in the /etc/sysconfig/network-scripts directory.

route-eth0 should look like:
default via 172.16.1.1 dev eth0 table 1

route-eth1 should be:
default via 192.168.0.1 dev eth1 table 2

rule-eth0 should look like:
from 172.16.1.110/16 tab 1 priority 500

rule-eth1:
from 192.168.0.2/16 tab 2 priority 600

These will trigger routing and rule commands each time the interfaces are started, and will allow for proper routing in your dual isp scenario.
 
  


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
Bind application to interface...or some fancy routing? IscreaMan Linux - Networking 1 04-19-2009 07:32 AM
routing to multiple isp lhrt Linux - Networking 2 10-12-2006 12:07 AM
Routing a server on a broadband ISP scratched Linux - Networking 5 05-23-2006 12:17 PM
Can the ISP find out if I do routing and IP fowarding? brfsa Linux - Networking 7 11-22-2004 12:14 PM
routing two isp connection to lan using linux box tisson Linux - Networking 2 09-08-2004 08:39 PM

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

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