Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-08-2010, 01:53 PM   #1
Registered: Jun 2007
Posts: 118

Rep: Reputation: 17
connecting to a wireless network via command line


I am trying to write a script to connect my system with a wireless network. The following were the commands I tried for the same:


#>> ifconfig wlan0 up

#>> iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 00:36:0E:10:63:53
Frequency:2.462 GHz (Channel 11)
Quality=33/70 Signal level=-77 dBm
Encryption keyn
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
24 Mb/s; 36 Mb/s; 54 Mb/s
Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s

#>> iwconfig wlan0 essid MYNETWORK key s:mykey

Then I ran dhclient wlan0 for which i got an message saying that dhclient is already running. so i killed that and ran 'dhclient wlan0' which eventually failed.

Can you guys help me in this?

I am not good at anything particularly with network. If this is a dumb question please ...

I am using Fedora 12 with Hp pavilion laptop.

Old 08-08-2010, 08:13 PM   #2
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
I would suggest that you disable encryption on your router at first. Once you have connected, then you should look into how to use wpa_supplicant to connect to a password protected router. For what it's worth, these commands allow me to connect this netbook to my router:
ip addr add dev wlan0
ip link set wlan0 up
wpa_supplicant -B -c/etc/wpa_supplicant.conf -iwlan0 -Dwext
ip route add dev wlan0
ip route add default via dev wlan0
As you see I don't use dhcpd, I use static addresses on my LAN. The passwords go in /etc/wpa_supplicant.conf - read the man page to find out more.
Old 08-08-2010, 09:31 PM   #3
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 3,304
Blog Entries: 1

Rep: Reputation: 686Reputation: 686Reputation: 686Reputation: 686Reputation: 686Reputation: 686
I do a fully manual non-DHCP connection on my home network.


  iwconfig  $wireless_interface  power all
  iwconfig  $wireless_interface  txpower auto
  iwconfig  $wireless_interface  rate auto
  iwconfig  $wireless_interface  channel 6
  iwconfig  $wireless_interface  essid $ESSID
  iwconfig  $wireless_interface  mode "Ad-Hoc"
  iwconfig  $wireless_interface  key restricted $KEY
  ifconfig  $wireless_interface  $CURRENT_IP netmask up
  ifconfig  $wireless_interface  mtu $MTU
  route add default gw $CURRENT_GATEWAY
But that's WEP encryption. And Ad-Hoc seems to be the only mode that works with my wireless drivers.

When connecting to DHCP networks over wireless I often have to set a few of the things like channel, rate, essid, and mode before running dhclient3. Sometimes I even have to set an IP address for myself before it actually works.

Something like this for the local McD's, before I realized you had to PAY for access, but CAN'T pay IN STORE.

  iwconfig $wireless_interface essid $DHCP_ESSID
  iwconfig $wireless_interface mode $DHCP_MODE
  iwconfig $wireless_interface key $DHCP_KEY
  iwconfig $wireless_interface channel $DHCP_CHANNEL
  echo "# dhclient3 $wireless_interface -s $DHCP_ESSID"
  dhclient3 $wireless_interface -s $DHCP_ESSID
But ndiswrapper isn't the most capable driver option out there IMO.
Old 08-10-2010, 12:24 AM   #4
Registered: Jun 2007
Posts: 118

Original Poster
Rep: Reputation: 17
Hi Guys,

As I said, I am nobody in networking. I appreciate your response,Still I didnt get anything :-).

Will google with your responses. Thank you guys.



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
[SOLVED] Connecting ADSL modem using command line for Network Manager NiaNok Linux - Networking 7 07-24-2010 12:51 PM
Command line tool for connecting/configuring wireles connections? (or independent gui mitchell7man Linux - Software 2 04-22-2010 05:35 AM
Connecting to a wireless network from command-line Daravon Linux - Newbie 21 12-06-2009 02:35 AM
Connecting to wireless network using command line. imagine_me2 Linux - Newbie 2 12-03-2009 05:28 AM
Connecting via the command line jawq Linux - Newbie 2 06-16-2005 10:44 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration