LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
 
LinkBack Search this Thread
Old 07-08-2011, 02:33 PM   #1
seth3k
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Rep: Reputation: 0
linux source routing problem


Hello everyone.
I have a weird issue with source routing on a linux box.
The plan goes like this:
I have 2 internet providers at my office and i want to use a single router to route them both ( i don't need load balancing or failover). I just want access to either provider based on the ip i use on my pc.

The first provider, let's call it RDS, is simple: i've got an RDS_IP, RDS_MASK and RDS_GW.
The second provider is complicated, we'll call it INES. I have a INES_IP, INES_MASK, INES_GW and they also gave me a subnet of public ip's: ILAN_NET which i have to route myself through INES_IP.

I also have a third nic with an local ip: LAN_NET and an alias for the INES subnet: ILAN_NET

the router has dhcp enabled, giving by default ip's from LAN_NET and using the default gw, RDS

I have snat for the LAN_NET to go through RDS.

If i enter an ip from the ILAN_NET, instead of routing in through the INES_GW, it also goes through RDS_GW.

the routing i've used for about 5 months has worked perfectly untill one day, when it just stopped. this is my setup:

ip route add $RDS_MASK dev $RDS_IF src $RDS_IP table rds
ip route add default via $RDS_GW table rds

ip route add $INES_MASK dev $INES_IF src $INES_IP table ines
ip route add default via $INES_GW table ines

ip route add default via $RDS_GW

ip rule add from $RDS_IP table rds
ip rule add from $INES_IP table ines

ip route add $LAN_NET dev $LAN_IF table rds
ip route add 127.0.0.0/8 dev lo table rds

ip route add $ILAN_NET dev $ILAN_IF table ines
ip route add 127.0.0.0/8 dev lo table ines

what puzzles me the most is that this setup has worked, and now it doesn't .... without any changes on the router.
I've tried everything save for a format/reinstall.

Is there a better/different way to do this?
Thanks.
 
Old 07-08-2011, 02:51 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Distribution: Arch 2014.02.01
Posts: 2,317
Blog Entries: 1

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
do you have any traceroute, ping, arp, route information available to us? Is the box outputting anything (tcpdump)?

Can you reach any interface on the hardware router from the linux box? Are the link lights on?

The fact that it just stopped working out of nowhere would force me to check the obvious physical connections and such (cables, links, ports, etc...)
 
Old 07-09-2011, 06:34 AM   #3
seth3k
LQ Newbie
 
Registered: Feb 2011
Posts: 4

Original Poster
Rep: Reputation: 0
well, i have checked the hardware stuff.
The cables, the connection to both isp, the NIC's are all ok because the RDS uplink works fine, the INES uplink works if i plug it in another computer.
I can ssh on both eth0 and eth1 ip's from outside.

As i've said, if i traceroute from my pc, in which i've put a INES ip from the subnet i have, the pacakges go throuh rds gateway.

Let me give you the figures ( for obvious reasons i will use generic ip's ):

auto eth0 (this is the rds uplink)
iface eth0 inet static
address 1.1.1.97
netmask 255.255.255.0

auto eth1 (this is the ines uplink)
iface eth1 inet static
address 2.2.2.234
netmask 255.255.255.128

auto eth2 (this is the LAN interface)
iface eth2 inet static
address 192.168.1.1
netmask 255.255.255.0

auto eth2:1 (this is the INES subnet routed through the ines uplink)
iface eth2:1 inet static
address 3.3.3.145
netmask 255.255.255.248

The ip routes are in the first post.

router:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
3.3.3.144 0.0.0.0 255.255.255.248 U 0 0 0 eth2
2.2.2.128 0.0.0.0 255.255.255.128 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
1.1.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 1.1.1.1 0.0.0.0 UG 0 0 0 eth0

router:~# ip route show
3.3.3.144/29 dev eth2 proto kernel scope link src 3.3.3.145
2.2.2.128/25 dev eth1 proto kernel scope link src 2.2.2.234
192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.1.1
1.1.1.0/24 dev eth0 proto kernel scope link src 1.1.1.97
default via 1.1.1.1 dev eth0

Could this problem be related to a cache of the routes?

The fast solution would be to reinstall the whole system and be done with it. But if this happens again after 5-6 months... i don't want to make a habbit out of it
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp routing problem on linux server dont_stop_me Linux - Networking 5 02-01-2009 02:41 PM
source routing sulekha Linux - Networking 2 12-15-2008 03:58 PM
help please :) Problem routing through Linux box jrd426 Linux - Newbie 22 03-11-2006 06:26 PM
A routing Linux to win system problem jarethfox Linux - Networking 2 08-03-2003 09:08 PM


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