[lwlan-devel] linux-wlan won't work on kernel 2.6.22 (John)

FeRD ferdnyc at gmail.com
Thu Sep 20 04:21:59 EDT 2007


John wrote:
> What I don't get is with the new kernel, I have to run
>
> ifconfig wlan0 <IP>
>
> It would seem to make sense that all I need to do is
> run ifconfig wlan0 up and the dhcp would automatically
> assign the address but in my case I have to add an IP
> address.
>
>   
Actually, no. ifconfig triggers no outside operations to set up your 
networking, it's strictly a low-level tool to configure parameters of 
the network interface itself. That's also why you're not seeing a 
default route set in the "new kernel" scheme, because the routing table 
isn't being updated either. (This isn't any direct consequence of the 
kernel issue, whatever it is -- I haven't been following that. Most 
likely, it's fallout from the fact that said kernel change tripped up 
udev and prevented all of its normal device-setup wizardry from properly 
executing.)

Honestly, running ifconfig itself "by hand" is almost unheard of these 
days, and certainly only as part of a debugging/testing/development 
process -- "normal use" wouldn't involve anything so low-level as a 
manual ifconfig. (...Not in the past decade, at least.)

Most (all?) Linux distros provide the /sbin/ifup utility script to 
manage all of the steps that go into configuring various types of 
network interfaces and connecting them to the varied types of networks 
they may need to access. It's ifup that takes charge of executing (based 
on hardware information and configuration supplied in /etc/sysconfig/) 
the steps needed to make wlan0 live.

So, really, assuming your network configuration in 
/etc/sysconfig/network/ is correct (set up via system-config-network, at 
least on my Fedora machines), bringing up wlan0 should be as simple as 
running:

/sbin/ifup wlan0

...Which will trigger various steps, INCLUDING but in no way limited to:

dhclient wlan0
ifconfig wlan0 <some_ip> {<various_other_settings>...}
route add default <some_gateway> {<various...>}

...Now, all that being said, ifup has some "issues" (oh, screw it, 
they're problems[*]) -- it takes NO parameters other than the name of a 
network interface, is completely monolithic, and requires that 
/etc/sysconfig/networking-scripts fully understand and support your 
interface and its configuration to your network. So, what happens when 
(say) there are wlanctl-ng commands you need to run YOURSELF (for 
whatever reason), somewhere in between (say) steps 3 and 4 of ifup's 
magic? Bad news. You can't. (You have to teach them to ifup via 
/etc/sysconfig/networking-scripts, or not use it.)

In your case, tho, for testing purposes -- throwing out DHCP since, if 
you're going manual, why bother? -- after ifconfig'ing the interface 
with an IP address (and netmask, if it's other than the standard 
255.255.255.0 -- but it almost certainly isn't), you'd need to add a 
default route thru the gateway of that interface, which takes the form:

/sbin/route add default gw <gateway_ip> dev wlan0

At THAT point you should be able to ping computers outside of your local 
network... but only by IP address. If you want DNS, you'll also have to 
add a couple of lines to /etc/resolv.conf like:

nameserver ip.the.first.here
nameserver ip.the.second.here

(Hey, I never said there wasn't a lot going on behind a "simple" ifup!)


BTW, in taking the "by hand" approach to this stuff, you CAN get a bit 
of help, simply by cheating off of ifup's test paper for the answers.

Because ifup is simply a (complex) shell script that triggers a whole 
twisty mess of other shell scripts, those operations can be handily 
traced using the Bourne shell's -x flag. Thus, a nifty 
debugging/sanity-checking trick is to run ifup like so:

/bin/bash -x /sbin/ifup wlan0

...And you'll get a long, mostly-boring, but ultimately enlightening 
play-by-play of everything ifup goes through in attempting to make wlan0 
ready for prime time. Lines preceded with a "+" sign are script 
operations. Anything else is actual output of the script. The two are 
intermingled, so you get to see lots of redundancies like:

+ echo "Sorry, Dave, I'm afraid I can't do that."
Sorry, Dave, I'm afraid I can't do that.

C'est la vie.

-FeRD

P.S> [*] - Why am I unkind in my comments about ifup, despite it being a 
very useful tool? Because it reminds me way too much of using an Apple 
Mac (especially pre-OS X) -- works fine-n-dandy when it works, and 
/ususally/ does indeed work, but everything happens automagically with a 
big flourish of "pay no attention to the man behind the curtain" 
mystique. Minimal user input (just the name of the interface) needed but 
absolutely NOTHING MORE _accepted_, the same zero lines of output 
whether the result is success or failure, and there's a great yawning 
chasm of a difference between a philosophy of not "bothering" the user 
with lots of narrative logging, and giving the user absolutely NOTHING 
in the way of operations tracing should one _ASK_ to be "bothered" with it!




More information about the Linux-wlan-devel mailing list