How to configure wifi from the commandline

How to do things, solutions, recipes, tutorials
Message
Author
normanp
Posts: 6
Joined: Sat 11 Oct 2008, 12:42

#76 Post by normanp »

rmmod b43
modprobe b43
ifconfig wlan0 up
iwconfig wlan0 essid myessid
iwconfig wlan0 key mykey
ifconfig wlan0 down
ifconfig wlan0 up
dhcpcd -d wlan0
I tried the above up to dhcpcd -d wlan0
This then gave me info up to 'broadcasting for a lease'
sending DHCP_DISCOVER several times then trying old lease - not found
then eventually adds address 169.254.160.169/16.

I can ping 169.254.160.169 successfully

Does this mean the driver is OK but the issue is with my router?
Thsi would be surprising as the router is fine when connecting from win xp.

Does it matter if the essid or key are upper or lower case?

Is there any way to be able to copy from the console window and paste here to show in detail what happened?

Thanks for any help.
BTW I am trying the console approach because the wizard gives no detailed feedback as to why it failed to connect.

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#77 Post by tempestuous »

Try the dhcpcd command like this -

Code: Select all

dhcpcd -I '' -d wlan0
That's hyphen, capital i, space, apostrophe, apostrophe (not quotation marks).

This information can be found in "How to configure wifi from the commandline "
http://www.murga-linux.com/puppy/viewtopic.php?t=22469

normanp
Posts: 6
Joined: Sat 11 Oct 2008, 12:42

#78 Post by normanp »

Thanks tempestuous - I have tried this and the result is the same - the DHCP_DISCOVER fails as before. Is there a log file that I can consult?

mawebb88
Posts: 246
Joined: Sun 13 Jul 2008, 09:54
Location: France nr Lyon

WPA in Puppy 4.1 (SD card) on an EeePC901(rt2860sta driver)

#79 Post by mawebb88 »

Got this working following the instructions in the thread (many thanks). Put the code into an executable script and a link to it in the Startup folder. I use a static IP address. No luck with the Network Wizard but this works just fine for me:

Code: Select all

ifconfig ra0 up
rm /var/run/wpa_supplicant/*
wpa_supplicant -i ra0 -D wext -c /etc/network-wizard/wireless/wpa_profiles/wpa_supplicant.conf -B
sleep 1
ifconfig ra0 192.168.1.239 netmask 255.255.255.0 broadcast 192.168.1.255
route add default gw 192.168.1.1
sleep 1
iwconfig ra0 key open
The wpa_supplicant is:

Code: Select all

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
update_config=1

network={
	ssid="my ssid"
	scan_ssid=1
	psk="my psk"
	proto=WPA
	key_mgmt=WPA-PSK
	pairwise=TKIP
	group=TKIP
}

juhasza
Posts: 1
Joined: Fri 31 Oct 2008, 19:17

iwconfig not working ?

#80 Post by juhasza »

Hello
I configuring my wlan ,and i look this:
# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11b ESSID:off/any
Mode:Managed Frequency:2.437 GHz Access Point: Not-Associated
Bit Rate:11 Mb/s Tx-Power:24 dBm Sensitivity=0/3
RTS thr:off Fragment thr:off
Encryption key:6B69-6E67-614B-494E-4741-3132-33 Security restricted
Power Management:off Link Quality:0 Signal level:0 Noise level:0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0


# iwconfig wlan0 essid "nokia6ex"
# iwconfig
lo no wireless extensions.

wlan0 IEEE 802.11b ESSID:off/any
# uname -a
Linux puppypc 2.6.25.16 #1 Tue Aug 26 10:45:53 GMT-8 2008 i686 GNU/Linux

where my esid ??

# cat /etc/issue
Puppy Linux
Linux 2.6.25.16 [i686 arch]

thanks
a

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#81 Post by tempestuous »

normanp wrote:DHCP_DISCOVER fails as before.
Is there a log file that I can consult?
Probably. /tmp/bootsysinit.log?
Yes, there have been various reports on the forum about problems with dhcpcd. Some suggestions:

Configure via the latest version of the Network Wizard from here
http://www.murga-linux.com/puppy/viewtopic.php?t=31522

dhcpcd may not be playing well with your particular wifi router. So just assign a static IP address instead. Instructions are in the first post in this thread.

Yankeeboy
Posts: 5
Joined: Mon 03 Nov 2008, 09:18

OK, so I've read through all 6 pages of this forum, but

#82 Post by Yankeeboy »

I can see that it is possible to configure my wireless card from the command line.

In fact, I have done it successfully. My problem is that I can't get this configuration to work at boot time. It always requires manual intervention.

Perhaps I don't understand the init system, or the order that init is occuring is causing me problems.

My status so far is that I finally managed to get the correct driver (ath_pci) to load, and suppressed the loading of an incorrect (ath5k_pci, I think it was called). I'm still not exactly sure what change I made which allowed this to happen, but suffice it to say that the Network Setup Wizard did not ever manage to get this right.

in fact the NEtwork Setup Wizard seems to have undergone a regression, in that it no longer saves any configuration options.

normanp
Posts: 6
Joined: Sat 11 Oct 2008, 12:42

#83 Post by normanp »

Thanks again tempestuous
I forced a static IP address with no success either - even though ifconfig reported my static IP etc correctly.
The updated network wizard is now buried in a long thread and I can't find it any more... I think it was at about page 26! When I last saw it it hadn't changed since Oct 15th anyway - a version I tried with no success.

I find it strange that the b43 driver in the wizard's list doesn't mention mini-PCI... maybe this is the wrong driver for the Broadcom chip?

I'll download 4.4.1 - maybe it will work better!
So many of us now rely on wireless for home use that I think it is a make or break issue for Linux desktop distros now.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#84 Post by 01micko »

Is there a problem with dhcpcd? I can connect with dhcpcd with the first machine I boot, but if I boot the next machine I must use a static IP.
I'll explain (btw, same with 4.1 or 4.11 on either machine)
I configure machine "a" with dhcpcd and connect just fine. I'll configure machine "b" the same and it won't connect using the wizard or from the command line. The result is dhcpcd continues and I get message "wlan0 sleeping for 10 seconds". So I abort and set up with a static IP.
Now if I boot machine "b" first, it will connect with the saved static IP fine. Then I'll boot machine "a" and it wont connect. Workaround is to assign it a static IP. All well and good but it is not the solution. :?
Any ideas?

User avatar
davids45
Posts: 1326
Joined: Sun 26 Nov 2006, 23:33
Location: Chatswood, NSW

#85 Post by davids45 »

G'day up there,
I too am suspicious that there is a problem with dhcpcd.
When starting my desktop in Puppy and connecting using a dhcpcd address, the better half's laptop running XP nearby would stop responding, or if I got in first, she could not connect to our router when she started up XP.

I have also been noticing (using rutilT as a monitor) that I can link to the router immediately (with ndiswrapper & wpa_supplicant) but getting an address and a stable connection could take a minute or two of disconnects and reconnects - with a 169.xxx address showing, until for some mysterious reason, a correct 192.168.xxx address and a firm connection would appear. Other times, an instant connect.
I have given up on auto dhcpcd and am now trying to set up my Pups with a static IP address, hoping this may at least be XP-friendly.

Another oddity to me is that occasionally I can connect to the router and my LAN, but there is no internet (WAN) connection for at least some time. This I assume is a problem in the router and with wireless, but wonder if anyone else has had this amongst their wifi experiences.

Meanwhile, back at the topic, I'm concerned that in using the command line approach after having tried the wizard that there may be a conflict between wizard residues and the new command line instructions.

Is there a way to check for or clear any wizard left-overs in the same way we can remove old wpa files in /var/run? I tried altering the permission of rc.network to stop it executing but this made my wine progams take a minute or two to start in the Pup/wine combination I was running at that time. I use Mailwasher as my first program once I connect to the Net, so this strange delay is not desirable.

David S.

normanp
Posts: 6
Joined: Sat 11 Oct 2008, 12:42

#86 Post by normanp »

OK - tried 4.1.1 with no success - I give up!
Well I'll use Puppy for emergencies but I can't spend any more time on it.
I think I have tried all ways of operating the wizard (including failed ndiswrapper). It is so frustrating as Win XP works just fine so ndiswrapper should. I have also tried at the command line as above.
Just for the record the card is a Dell Wireless 1370 Mini-PCI (Broadcom chipset)
A shame as I like Puppy a lot...

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#87 Post by 01micko »

@ normanp
Be sure if using the wizard to set your preferred DNS IP the same as the gateway IP if using static IP. Works for me. :wink:

normanp
Posts: 6
Joined: Sat 11 Oct 2008, 12:42

#88 Post by normanp »

Hi 01micko
Do you have the same wireless card as me?

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#89 Post by 01micko »

No but I use two separate systems, one using Netgear pcmcia card wg511v2, must use ndiswrapper (Marvell chipset), the other using Netgear usb stick wg111v2 using linux module rtl8187 (Realtek chipset). Keep trying! 8)
Puppy Linux Blog - contact me for access

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Re: iwconfig not working ?

#90 Post by gyro »

juhasza wrote:where my esid ??
The ESSID for your network is defiined in the wireless Access Point/Router. I think it is case sensitive.
Provided your wireless Access Point is broadcasting it's ESSID, the wizard will tell you what it is when you click on the "Scan" button.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#91 Post by gyro »

01micko wrote:@ normanp
Be sure if using the wizard to set your preferred DNS IP the same as the gateway IP if using static IP. Works for me. :wink:
But that does not mean it will work for others.
If your modem/router (gateway), implements a caching name server, then sending DNS requests directly to it, will work. But many modem/routers do not, so their dhcp server passes on the DNS server addresses it gets from your ISP. In this case you would need to configure DNS to be the addresses provided by your ISP, if you do static IP configuration.
Of course if you can get dhcp to work, then these things are taken care of, automatically.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#92 Post by gyro »

01micko wrote:Is there a problem with dhcpcd? I can connect with dhcpcd with the first machine I boot, but if I boot the next machine I must use a static IP.
I'll explain (btw, same with 4.1 or 4.11 on either machine)
I configure machine "a" with dhcpcd and connect just fine. I'll configure machine "b" the same and it won't connect using the wizard or from the command line. The result is dhcpcd continues and I get message "wlan0 sleeping for 10 seconds". So I abort and set up with a static IP.
Now if I boot machine "b" first, it will connect with the saved static IP fine. Then I'll boot machine "a" and it wont connect. Workaround is to assign it a static IP. All well and good but it is not the solution. :?
Any ideas?
What IP address do you get when you successfully connect only machine "a" with dhcp?
What is the "range" configured in the dhcp server on your modem/router?

gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#93 Post by 01micko »

gyro said
What IP address do you get when you successfully connect only machine "a" with dhcp?
What is the "range" configured in the dhcp server on your modem/router?
192.168.33.2
192.168.33.2 to 192.168.33.254

Mind you I am using an obscure router, a Synet Windy31. Runs thru a window$ box so I can share my wireless broadband. Works fine.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#94 Post by gyro »

01micko wrote: 192.168.33.2
192.168.33.2 to 192.168.33.254

Mind you I am using an obscure router, a Synet Windy31. Runs thru a window$ box so I can share my wireless broadband. Works fine.
Sorry 01micko, I was just wondering if there was a reason why it might appear that the dhcp server on your router had only 1 IP address to lease.
But it looks as though the router config is fine. So I'm back to being mystified.

Gyro

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#95 Post by 01micko »

Gyro said
Sorry 01micko, I was just wondering if there was a reason why it might appear that the dhcp server on your router had only 1 IP address to lease.
But it looks as though the router config is fine. So I'm back to being mystified.
Yesterday I introduced a vi$ta(call it "c") machine to the equation. My main puppypc (a) was running as usual (dhcpcd assigned 192.168.33.2 as normal) and the vi$ta box, machine "c", connected with dhcp assigning it 192.168.33.3 with no problems. This only makes me more suspiscious of a dhcpcd problem in puppy with more than one puppypc on the network. I'll stuff around some more with these three machines to see what I can come up with. Mind you it may take some time because the new machine is a Chrissy present for my son, so have to play with it when he is at school. I'm sure the new machine will become a puppypc too because my son has grown to like puppy. :wink:
Puppy Linux Blog - contact me for access

Post Reply