Results 1 to 1 of 1

Thread: Connect to a WIFI network from Ubuntu Terminal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2005
    Location
    India
    Posts
    11,004

    Default Connect to a WIFI network from Ubuntu Terminal

    Requirements

    - An Ubuntu PC and Internet connection (Ethernet).
    + Tested version: Ubuntu 14.04

    - A WIFI network card.

    - A WIFI Router that offers DHCP IP address.

    Choose your network and carry on.

    1. Open WIFI Network (No password):

    Code:
    $ ifconfig wlan0 down
    $ dhclient wlan0 -r
    $ ifconfig wlan0 up
    $ iwconfig wlan0 essid "your_essid"
    $ iwconfig wlan0 mode Managed
    $ dhclient wlan0
    2. WEP WIFI Network:

    Code:
    $ ifconfig wlan0 down
    $ dhclient wlan0 -r
    $ ifconfig wlan0 up
    $ iwconfig wlan0 essid "essid"
    $ iwconfig wlan0 mode Managed
    $ iwconfig wlan0 key hexadecimal_key
    OR
    $ iwconfig wlan0 key s:ascii_key
    $ dhclient wlan0
    3. WPA/WPA2 WIFI Network:

    This is a little bit different method. First, you have to install wpasupplicant package:

    Code:
    $ sudo apt-get install wpasupplicant
    Next, create a file that we'll call "wireless-wpa.conf":

    Code:
    $ sudo nano wireless-wpa.conf
    Now, write the following code inside:

    Code:
    ctrl_interface=/var/run/wpa_supplicant
     
    network={
              ssid="the_router_ssid"
              scan_ssid=1
              key_mgmt=WPA-PSK
              psk="the_wpa_key"
            }
    Save the file. Now execute the following:

    Code:
    $ ifconfig wlan0 down
    $ dhclient wlan0 -r
    $ ifconfig wlan0 up
    $ iwconfig wlan0 mode Managed
    $ killall wpa_supplicant
    $ wpa_supplicant -B -Dwext -i wlan0 -c ./wireless-wpa.conf -dd
    $ wpa_supplicant -B -Dwext -i wlan0 -c ./wireless-wpa.conf

    -B means run wpa_supplicant in the background.
    -D specifies the wireless driver. wext is the generic driver.
    -c specifies the path for the configuration file.

    Obtain IP address by DHCP

    Code:
    $ sudo dhclient wlan0
    Use the ip command to verify the IP address assigned by DHCP.

    Code:
    $ ip addr show wlan0
    that's all!!
    Last edited by melbin; 10-29-2014 at 06:51 AM.
    VIDEO WORLD : LATEST HOLLYWOOD || BOLLYWOOD || SOUTH INDIAN VIDEOS || TRAILERS

Tags for this Thread

Bookmarks

Posting Permissions

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