LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-07-2004, 11:19 AM   #1
Klas
Member
 
Registered: Oct 2003
Location: Uppsala, Sweden
Distribution: Mandrake 9.1, Mandrake 10.0
Posts: 77

Rep: Reputation: 15
How can i choose network card (eth0 or wlan0) to connect to internet?


Hi

I have a laptop with both a usual ethernet connection (eth0) and a PCMCIA card (wlan0) in my LAN.

All three pc's in my LAN are using Mandrake 9.1.

Thanks to Linuxquestions i seem to have got my wlan card working (...the huge 8180 thread in wireless networking). I have manually assigned IP and GW to that card. I also can ping it from my other pc's.

So now i have both a wlan and a usual nic in that box, connected to the same network.


Question:
How can i control the interface used? I mean sometimes i want to connect to the LAN using WIFI, and sometimes the usual cable way (...when transfering files etc.).

This doesnt need to be automated at all, if its possible to make a script and use a icon on my desktop thats enough...

I can connect to internet using cable on the laptop, but i cant figure out how to do it with wlan

Regards Klas
 
Old 05-07-2004, 12:13 PM   #2
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
You probably need to modify the current gateway.
I am writing 'probably' since your question is not precise. Probably you have the computer connected to the LAN1 via eth0 and to the LAN2 via wlan0. Perhaps LAN1 = LAN2 (?).
In case of LAN1=LAN2 I assume your question concerns redirection all the traffic (i.e. to the local hosts and external hosts as well) (?). If LAN1=LAN2 but you want to reach local hosts via one i/f and external hosts via second one - you has to modify your routing table (see 'man route').

Last edited by dorian33; 05-07-2004 at 12:14 PM.
 
Old 05-07-2004, 02:05 PM   #3
Klas
Member
 
Registered: Oct 2003
Location: Uppsala, Sweden
Distribution: Mandrake 9.1, Mandrake 10.0
Posts: 77

Original Poster
Rep: Reputation: 15
Ok ill try to be a little more precise

Yes LAN1=LAN2

Yes sometimes i want to use Only my WIFI card for All traffic.... and sometimes my usuall NIC and a cable for All traffic.

I mean... if i have two cards in my box connected to the same LAN, how can i make sure that all traffic passes thrue wlan0 instead of eth0 (who my pc is default configured for now)?

If i remove my network cable from my laptop how can i then make sure that i can, for instance surf the webb using my wlan card instead?

Is mozilla for example default configured for using eth0??

Do i need to "route" all traffic normaly going thrue eth0 to wlan0?

Sorry if my questions are stupid... i just try to understand

Regards Klas
 
Old 05-07-2004, 03:39 PM   #4
dorian33
Member
 
Registered: Jan 2003
Location: Poland, Warsaw
Distribution: LFS, Gentoo
Posts: 591

Rep: Reputation: 32
Quote:
I mean... if i have two cards in my box connected to the same LAN, how can i make sure that all traffic passes through wlan0 instead of eth0 (who my pc is default configured for now)?
Just down that interface you do not need :) See 'man route' - there is the way to define the interface you want to use for LAN/internet connection.
Using '/sbin/route' you'll find the gateway IP and interface through the packets are exchanged with your LAN and internet.
For example:
Code:
bash-2.05b$ /sbin/route
Kernel IP routing table
Destination     Gateway              Genmask      Flags Metric Ref Use Iface
192.168.0.0        *               255.255.0.0     U      0    0     0   eth0
loopback         localhost           255.0.0.0     UG     0    0     0    lo
default          <your gateway IP>     0.0.0.0     UG     0    0     0   eth0
Quote:
If i remove my network cable from my laptop how can i then make sure that i can, for instance surf the webb using my wlan card instead?
Since both cards connects the same LAN you have (probably) only one gateway. But (in the usual case which is the subject) it can be reached using one card only. I don't know in what way it is chosen when both interfaces are up (if not declared explicitly in gateway declaration). I believe the fastest is chosen. So if accidentally you down the NIC which is gateway-related one you probably cut all the LAN/internet traffic.
Quote:
Is mozilla for example default configured for using eth0??
Absolutely not!
Quote:
Do i need to "route" all traffic normally going through eth0 to wlan0?
If you down unwanted interface there will not be another way for the packets.
I am not sure but I believe the 'old' default gateway needs to be deleted and just added (the same one). It then 'switch' to the currently available interface assuming that using 'route' for that you do not use explicit interface specification).
 
Old 05-07-2004, 04:36 PM   #5
Klas
Member
 
Registered: Oct 2003
Location: Uppsala, Sweden
Distribution: Mandrake 9.1, Mandrake 10.0
Posts: 77

Original Poster
Rep: Reputation: 15
Thumbs up

Thanks Dorian for your clear answer!
It worked exactly as you said, I am now able to surf using my wlan card.

It seemd like i can have one "Default GW" per card, so when i "downed" eth0, the default gw for that card was also brought down. But the default gw for wlan0 was still up.

Thanks again
Klas
 
  


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 for eth0 and wlan0 with static IPs on the same network. kelvinlo Linux - Wireless Networking 3 10-15-2007 04:54 PM
How to connect to the internet using network card? Henningstrom Linux - Newbie 6 02-27-2005 08:48 PM
my new network card cant connect to internet klara Linux - Networking 5 09-02-2004 08:39 AM
Mandrake 9.2 can't get network running on eth0 or eth1 but can on wlan0 llindir Linux - Networking 2 03-20-2004 01:11 PM
Not able to connect to the internet (I suspect my network card to be the problem) Moominpeikko Linux - Networking 2 08-31-2003 03:01 PM

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

All times are GMT -5. The time now is 07:08 PM.

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