LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-21-2005, 06:22 AM   #1
mafiltenborg
Member
 
Registered: Jan 2004
Location: Denmark
Distribution: Debian, Debian, Debian
Posts: 81
Blog Entries: 3

Rep: Reputation: 19
network interface automatics


Got myself a laptop, an Atheros-based wlan-NIC, a dock with internal NIC and an urge to make this setup go online witout me doing too much manual work everytime i want to connect.

But how? Manually enabling the interfaces and assigning ip-adresses to them using dhclient is possible. The dock-NIC works if i power-cycle the machine, but the wireless NIC doesn't do anything but load the ath_pci.o module. I must manually assign ssid using iwconfig, execute wpa_supplicant and dhclient ath0 in that order to get wireless connection.

I haven't figured out how to make the various installed subsystems (hotplug, network daemons etc) do this work for me, let alone figured out how to prioritize connections.

How do i engage auto-management? I figure hotplug and cardmgr will autoload modules all right, but what is the mechanism driving higher-level network-setup?

My setup: Dell C600, Dell Latitude C/Dock w. 3com NIC, Proxim 8470-WD PCCard wlan-NIC and a Linksys WRT54G router. On top of this a debian Sarge, supplied by manually compiled madwifi-module for the Proxim-NIC.

I've seen people running WinXP do this; pop in a card, go online. Exchange it for a cable, go online again instantly. 'Aber so ein ding müssen wir auch haben!' i think.

But how? So far, reading howto's brought me nowhere, as they tend to *not* deal with the dynamics of networking.

Thanks in advance,
Martin
 
Old 03-22-2005, 07:53 AM   #2
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

on windows things are not so automatic as they appear :
you can set up different connexion profiles, but profile managers are just scripts that read the conf file and apply it... nothing you cannot do with a shell script.
You talk about wpa... no windows user can plug in a card and use a wifi network protected by wpa without doing a bit of configuration (or if he can, then the network admin must have forgotten a few security settings )
as for the exchange of wire/wireless... I must tell that if I had to do this, I would create a small dameon that looks which interfaces have link... and enables the best one. There may be better solutions (I'm not a programming guru), like using the calls generated by your system when a NIC comes up...
But I think all this is pretty complex (and a useless way of consuming ressources) when compared to the problem you have : when you plug/unplug your cable, it's not very complicated to run a shell script that reconfigure your network !

Last edited by fr_laz; 03-22-2005 at 07:56 AM.
 
Old 03-22-2005, 08:19 AM   #3
scowles
Member
 
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 31
In the redhat world, there is a "work in progress" RPM called NetworkManager that seems to address your post. According to the arcticle, it says it works with Debian.

Good Luck!
 
Old 03-23-2005, 02:35 AM   #4
mafiltenborg
Member
 
Registered: Jan 2004
Location: Denmark
Distribution: Debian, Debian, Debian
Posts: 81
Blog Entries: 3

Original Poster
Rep: Reputation: 19
scowles: I'll look into NetworkManager. It appears to address the issue all right, although my curiosity regarding the way Linux is cut out to do this using its existing structure will remain unsatisfied.

Writing my own daemon-thing doing this job would be redoing NetworkManager functionality - which doesn't make the idea wrong or anything like that. Thanks.

A few scripts to do the job simpler/easier? Yes. Already halfway there. If NetworkManager doesn't cut it, this is what i'll do.

fr_laz: I've failed to express myself correctly. The automatics in XP of course only works on preconfigured interfaces. I've seen it work on my brother in law's laptop, where enabling the internal Wlan nic makes XP apply a preconfigured profile including securitysettings etc. Online in a snap! Disabling the wlan nic gets you offline, and plugging in a cable causes you to go online again. There are even little icons in the system tray telling you which interfaces are up/down.

Now i think i'll go tinkering for a while
 
Old 03-23-2005, 07:05 AM   #5
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Re,

I didn't want to be rude in my last message
Actually, I'm using such kind of tools on my windows laptop (professional so I've to use as it is), but this "access connexion tool" just keeps bugging me : it's just unstable. It will work ten times, and then without any real reason it hangs... so that I used scripts to do this with windows too.
But of course, even though I prefer doing things by hand (by script), it's just cool that things like network manager are being developped, so that Linux can become more and more user friendly for those who want it this way. I'll take a look to the project !

See you
 
Old 03-23-2005, 08:38 AM   #6
mafiltenborg
Member
 
Registered: Jan 2004
Location: Denmark
Distribution: Debian, Debian, Debian
Posts: 81
Blog Entries: 3

Original Poster
Rep: Reputation: 19
I didn't take your words for being rude in any way

Yeah, using W2K myself here at work. I don't mind, actually it works quite nice. Especially when you consider what i do to it...

Regarding the direction Linux as a whole is taking: Well, I have no ambitions on behalf of Linux to 'Conquer the world'. I might even think it's all right the way it is. Being overly userfriendly usually means removing all the mysterious and nasty handles and knobs, newbies tend to hurt themselves on - which is exactly what i think is good about linux; all the handles and possibilities. Not that i don't get a few bruises; once in a while i stumble upon something which gets me scratching my head, completely clueless as to 'where to now'. But then i reckon this is what makes me learn stuff, right?

Which is what i think is the negative side of stuff like NetworkManager: It lets me accomplish my task, but doesn't teach me anything about how the system works under the hood.

Taking this opinion to the extreme, GUI-frontends will over time reduce the user population to drooling zombies, not knowing the first thing about anything.

I'd much rather like to know about the mechanics of how the module-cardmgr-hotplug-blablabla-system works. Then, writing scripts etc. is just work to get over with.

I've read somewhere about the ifupdown-subsystem. Scripts 'n stuff i need to get sorted, 'alias ifname drivermodule' statements in whichfiledidyousay to do and such.

Oh well. I'll get it sorted out eventually

Meanwhile, all you guys/gals out there can drool over this wee setup of mine

Athlon64 Winchester 3000+
Asus A8N SLI
Corsair Dual DDR400 512 MB 2-2-2-5
NVidia 6600 PCIe graphics board

fueling a debian Sarge. All systems go!
 
Old 04-10-2005, 03:19 AM   #7
mafiltenborg
Member
 
Registered: Jan 2004
Location: Denmark
Distribution: Debian, Debian, Debian
Posts: 81
Blog Entries: 3

Original Poster
Rep: Reputation: 19
Intermediate - but working solution found!

Ha!

This morning - at 2AM - i got it working. At least to a level that will make me use the machine for real work

I've written a very small - and dumb - script, setting up WPA-PSK encryption for my atheros-wlan-nic.
It is to be executed before bringing up the interface ath0.

Now, investigating the ifupdown thing i stumbled upon the file /etc/network/interfaces. Doing 'man interfaces' got me wondering if it was possible to make the boot-scripts (executes 'ifup -a' to bring up interfaces present) also run my little script.

It was possible.

/etc/network/interfaces file now reads
------
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
name Ethernet kort (lan)

# my wlan...
iface ath0 inet dhcp
pre-up /root/wlan_up & #> /dev/null
name Wireless kort (wlan)
wireless_essid <name>

auto ath0
------

Now, at boot-time the wlan-nic first gets setup by my wee script, and then brought up using DHCP from my router - automatically.

The script? Well, setting up WPA-PSK turned out to be real easy. I feared this, as WPA requires yet another package to be installed and used: wpa_supplicant. Usually this means more complexity, but here it merely meant exchanging one complexity for another. You'll have to do your own bit of reading to get acquainted with wpa_supplicant, but having done that you might want to see how i've done my bit. The script file goes like this:

/root/wlan_up
------
#!/bin/sh
iwconfig ath0 essid <my-essid>
wpa_supplicant -i ath0 -D madwifi -d
------

wpa_supplicant takes a settings-file-thing which goes like this:

/etc/wpa_supplicant.conf
-----
network={
ssid="<my_ssid"
scan_ssid=1
psk="my_preshared_key"
}
-----

So, what happens is that the bootscripts execute ifup -a, which executes /root/wlan_up, which again assigns a essid to ath0 and runs wpa_supplicant - which uses the conffile to setup encryption. Finally ifup brings up ath0 and assigns a dhcp-address to it (dhclient?). All systems go!

Not perfect yet though... There's no automatics in this, as ifup appears to not know whether the wlan-nic is present before executing my script. If it isn't there (because i've physically removed the nic), the script fails, generating garbage onscreen. And it's oh-so-hardwired all of it

But it works.

doing iwconfig now gets me
----
# iwconfig
lo no wireless extensions.

ath0 IEEE 802.11g ESSID:"my_essid"
Mode:Managed Frequency:2.417 GHz Access Point: 00:01:02:04:08:0A
Bit Rate:54 Mb/s Tx-Power:50 dBm Sensitivity=0/3
Retryff RTS thrff Fragment thrff
Encryption key:you-d-like-to-know-wouldnt-you Security mode:restricted
Power Managementff
Link Quality=33/94 Signal level=-62 dBm Noise level=-95 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

sit0 no wireless extensions.
----
and doing ifconfig gets me
----
# ifconfig
ath0 Link encap:Ethernet HWaddr 00:10:20:40:80:A0
inet addr:10.63.24.100 Bcast:10.63.24.255 Mask:255.255.255.0
inet6 addr: yuck Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3186 errors:9379 dropped:0 overruns:0 frame:9379
TX packets:1393 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:199
RX bytes:629934 (615.1 KiB) TX bytes:181365 (177.1 KiB)
Interrupt:11 Memory:e093a000-e094a000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:132 errors:0 dropped:0 overruns:0 frame:0
TX packets:132 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8340 (8.1 KiB) TX bytes:8340 (8.1 KiB)
----

Just my 0.002 euros

//mA
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network Interface Status ejtbrown Programming 5 08-04-2006 01:12 AM
no network interface sardion8 Linux - Networking 2 08-17-2005 05:05 AM
Network interface phopkins Linux - Networking 2 04-27-2005 09:55 AM
why i see same packet twice on network interface? cranium2004 Linux - Networking 6 11-26-2004 09:42 AM
Configuring a 4 interface network evalastin Linux - Networking 0 06-28-2004 12:16 PM


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