Find the answer to your Linux question:
Results 1 to 6 of 6
For some reason Ubuntu 8.04 doesn't save my college network settings, so I have to connect manually each time. This is what I physically have to do to connect: 1) ...
  1. #1
    Just Joined! phalaris_trip's Avatar
    Join Date
    Jan 2007
    Posts
    21

    connect to network via command line

    For some reason Ubuntu 8.04 doesn't save my college network settings, so I have to connect manually each time. This is what I physically have to do to connect:

    1) Click on network manager icon in the notification area
    2) Click "connect to other wireless network"
    3) Type in "NETWORK_NAME" into network name area field
    4) Select WPA enterprise under wireless security
    5) Type in "USERNAME" into username field
    6) Type in "PASSWORD" into password field

    So what I would like to know: is there any command line equivalent for the above six steps? I would like to write a script which will carry out the above six steps for me automatically, using the parameters NETWORK_NAME, USERNAME and PASSWORD.

    Thank you!

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    Connecting to a network via the command line isn't difficult, but it is a little trickier with WPA encryption.

    You need to configure wpa_supplicant. Check if you have a config file already, at /etc/wpa_supplicant.conf. I don't think Ubuntu does, but if so, back it up.

    Then

    Code:
    sudo gedit /etc/wpa_supplicant.conf
    Add the following
    Code:
    ctrl_interface_group=0
    eapol_version=1
    
    #Sets AP sellection to be handled by wpa_supplicant or the driver.  
    # 0=driver 1=wpa_supplicant
    ap_scan=1
    
    network={
            ssid="some_secure_network"
            scan_ssid=1
            proto=WPA
            key_mgmt=WPA-EAP
            pairwise=TKIP
            eap=PEAP
            ca_cert="/etc/certs/CAcert.cer"
            identity="myusername"
            password="mypasswrd"
    }
    then

    Code:
    sudo wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf 
    sudo dhclient wlan0
    I'm not familiar with the Enterprise WPA encryption; if this doesn't work, you can check here for more information. You'll need to direct the certification file to the right place, I imagine.

    Also, you might want to check out replacing the network manager in Ubuntu with wicd.

  3. #3
    Linux User kmitnick's Avatar
    Join Date
    May 2008
    Location
    Jordan - Amman
    Posts
    329
    reed9:

    what is -B _Dwext?
    and what does dhclient, is it a tool to assign ip and so automatically???
    Dual Booting Ubuntu 10.04, Windows 7

    Toshiba Satellite A200-1M5, Duo Core 2.0 Ghz, 1 Gigs RAM, 256 Intel Card

    You are registered Linux user number 490788
    Happy Linuxing

  4. #4
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    Quote Originally Posted by kmitnick View Post
    reed9:

    what is -B _Dwext?
    and what does dhclient, is it a tool to assign ip and so automatically???
    Yup, DHCLIENT is a tool to request an IP address from a server. Some distros use DHCPCD instead.

    The -B flag tells it to run in the background. -D is to indicate a driver. wext, or Wireless Extensions, is a generic driver that works in the majority of cases.

    EDIT:
    If you're using WEP encryption or no encryption, to connect to a wireless network from the command line is just
    Code:
    sudo iwconfig wlan0 essid "MY WIRELESS" key s:my_wep_key
    sudo dhclient wlan0
    You can use
    Code:
    sudo iwlist wlan0 scanning
    to scan for wireless networks in range.

  5. #5
    Linux User kmitnick's Avatar
    Join Date
    May 2008
    Location
    Jordan - Amman
    Posts
    329
    thnx dude
    Dual Booting Ubuntu 10.04, Windows 7

    Toshiba Satellite A200-1M5, Duo Core 2.0 Ghz, 1 Gigs RAM, 256 Intel Card

    You are registered Linux user number 490788
    Happy Linuxing

  6. #6
    Just Joined! phalaris_trip's Avatar
    Join Date
    Jan 2007
    Posts
    21
    Thanks for the reply,

    I will try it out when I get home and post the results.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...