Configure wireless network from the command line

7,976

Since version 0.8.1, Network Manager comes with a command line tool, nmcli. Its capabilities in older versions are very limited; for the most part, you can use it to view available connections and switch between them but not configure new ones. Since version 0.9.6, nmcli can create new connections.

There are other, third-party command-line interfaces to Network Manager. Cnetworkmanager has more features than nmcli; in particular, it allows defining connections and specifying wifi encryption keys.

An alternative to Network Manager is Wicd, which provides both an X interface and a console interface.

If you want to do things “by hand”, the main tools you'll need to know are:

  • ifconfig for general information and activation of network interfaces.
  • iwconfig for settings that are specific to wifi interfaces, in particular the ESSID (network name) and WEP keys.
  • iwlist to get information about possible settings for a wireless interface (in particular iwlist scan to show available networks). A hidden network is one that won't show up on iwlist scan but still works when selected with iwconfig.
  • Wpa_supplicant to configure WPA-protected networks.

Some of your questions are completely unrelated to wifi configuration, so I'm not going to answer them here. Please don't ask unrelated questions in the same post.

Share:
7,976

Related videos on Youtube

AnkurVj
Author by

AnkurVj

Updated on September 18, 2022

Comments

  • AnkurVj
    AnkurVj over 1 year

    I know I can use ifconfig to configure my ethernet network interfaces. But can I also configure my wireless network interfaces using ifconfig. (It seems to be listed as eth1 in ifconfig output, why is that ?) Specifically :

    1. How do I check from command line if my wireless is enabled
    2. How do I enable / disable the wireless using commandline
    3. Out of a few available wireless networks how do I chose one and connect to it
    4. How do I configure the parameters (like username, password, security settings and certificate information) from the command line
    5. Sometimes an available wireless network is not visible for some reason. In such a case, I select "Connect to hidden wireless network" and type the name of the connection. How do I do the same from my terminal
    6. I recently installed xmonad, I'd like to know how to start the graphical network manager from command line
    7. How do I change my system-wide proxy settings from command line ?

    (I am using Ubuntu natty.)

    • hmontoliu
      hmontoliu over 12 years
      If you want pure CLI you'll need to stop network-manager; then you'll need iwconfig to manage wireless settings. And ifconfig to configure your interface IP settings (or dhcpclient if there is a dhcpd around). Also you should look at the wpa_supplicant command for WPA stuff if you need to.
  • jasonwryan
    jasonwryan over 12 years
    isn't ifconfig deprecated in favour of iproute2?
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 12 years
    @jasonwryan No, why should it be? ifconfig is a small tool for a dedicated purpose. ip is a Swiss army knife. They don't play in the same category. The author of ip does consider ifconfig and friends to be “legacy”, but the rest of the world seems fairly attached to this legacy.
  • jasonwryan
    jasonwryan over 12 years
    Arch went that way, also Debian: "our plans are to replace net-tools completely with iproute, maybe leading the route for other distributions to follow." lists.debian.org/debian-devel/2009/03/msg00780.html I figured it was inevitable...
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 12 years
    @jasonwryan Considering that ifconfig (and route and netstat) “have a very long history, and are extremely well known by many sysadmins, and used in many, many shell scripts”, including many Debian package maintenance scripts, it'll take a very long time to get anywhere close to deprecating them.
  • jasonwryan
    jasonwryan over 12 years
    ...so, that's a "yes" but not in my lifetime? :)