LinuxQuestions.org
Help answer threads with 0 replies.
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 12-19-2006, 12:09 PM   #1
JoeDuncan
Member
 
Registered: Aug 2003
Location: Ottawa
Distribution: Redhat 5.2, 6.0, 6.1, Mandrake 7.2, 8.0, 9.1, 9.2, 10.0, Gentoo, Debian 3.1r0
Posts: 224

Rep: Reputation: 30
Using eth0 as default network connection


Ok, here's my problem. Both at home and at work, I have wired and wireless connections. In both cases, the wired and wireless are connecting to the same network (my home network and work network are different networks, but in both places the wired and wireless connect to the same LAN and get the same DHCP addresses).

Now I have eth0 setup using ifplugd and wlan0 setup using wpasupplicant.

Now normally, I want to use the wireless for all my accesses because I can move around, however, the wired is much faster in both cases when trying to transfer files.

The problem is, if I connect the wired NIC and bootup, my laptop defaults to using the wireless first. To get it to use the wired connection as the default, I have to edit /etc/network/interfaces to disable the wireless access completely and reboot. Needless to say, this is a real pain.

I would like my laptop to use eth0 as the default connection if it's present and only use wlan0 if eth0 is not connected. I can't use the default gateway trick because the default gateways for both connections are the same.

So how can I make it so that my laptop uses the wired connection as the default connection and only uses the wireless connection if the wired connection isn't present?

I'm running Debian Testing (Etch) on a Dell Inspiron 1300.

Thanks!
 
Old 12-19-2006, 01:18 PM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Hi Joe,
In the above case, you can create a new rule with
#ip rule add to lan/subnet table 252
&
#ip rou add dev eth0 table 252

Thats it !!!
Do a ip rou flush cache & test it.

Basically we have asked our kernel to forward all the packets destined for lan/subnet to table 252 & thereafter in table 252 we have asked it to traverse out from eth0.

p.s. : You got to replace the underlined lan/subnet with your lan-ip series & its subnet.
 
Old 12-20-2006, 09:03 AM   #3
JoeDuncan
Member
 
Registered: Aug 2003
Location: Ottawa
Distribution: Redhat 5.2, 6.0, 6.1, Mandrake 7.2, 8.0, 9.1, 9.2, 10.0, Gentoo, Debian 3.1r0
Posts: 224

Original Poster
Rep: Reputation: 30
Ok, uhm, where do I do that? As far as I am aware "ip" is not a linux command. It looks like this is from a config file somewhere, but where?

Thanks!
 
Old 12-20-2006, 10:09 AM   #4
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Oh i am sorry for that. You need iproute2 package & dependencies for that to run. Try googling or browse this http://developer.osdl.org/dev/iproute2/download/
 
Old 12-20-2006, 12:05 PM   #5
JoeDuncan
Member
 
Registered: Aug 2003
Location: Ottawa
Distribution: Redhat 5.2, 6.0, 6.1, Mandrake 7.2, 8.0, 9.1, 9.2, 10.0, Gentoo, Debian 3.1r0
Posts: 224

Original Poster
Rep: Reputation: 30
Ok, so after I install iproute2 and run the given commands, it will reconfigure my laptop to send all traffic for the given lan/subnet to table 252, and from table 252 out from eth0?

A couple of questions:

What is table 252?

If all traffic from table 252 needs to go out eth0, what happens when eth0 is not connected and only wlan0 is?

Thanks!
 
Old 12-20-2006, 12:28 PM   #6
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
We have tables to do the routing & rules to do if then & else condition schema; & until we enter the scope or iproute2, we only end up having 3 routing tables; (0-255 in total)
255: LOCAL
254: MAIN
253: Default
& then whatever we creates.. we assign it a nos b/w 1-252.(so its not necessary tht you use table 252, but you can use any b/w 1-252)

@ the other concern of switching over to other link incase of inavailability of one: Hey we are doing static routing & not dynamic, so until our routing table have a scope for some packets; they cant override it. Probably i'll go through this in deep n lets see if i can find something for this in this scenario.
 
Old 12-20-2006, 12:32 PM   #7
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Joe,
This is very bad of a hack; but you can cron a script through which you can ping any consistent box in your subnet via eth0(while you have tht static routing) & as soon as you get timeout in your replies; you can flush those rules & routes & switch over to the more generic approach(switching ath0 ON). Though this is not seriously adivsable but still until i find something legitimate, you can try this.

EDIT : Spelling of through.

Last edited by amitsharma_26; 12-20-2006 at 12:40 PM.
 
  


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
No network connection, no ip address on eth0 HawkLawin Linux - Newbie 6 06-02-2006 09:10 PM
eth0 is up but no network connection? yednotek Linux - Newbie 4 04-01-2006 03:21 PM
eth0 and eth0:1. Default gateway is not working Fillys6 Linux - Networking 1 12-21-2005 09:33 AM
Wireless network on eth1 diabled Ethernet eth0 and eth0 never comes back tadatoshi Linux - Wireless Networking 4 09-23-2004 05:57 PM

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

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