Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.