Set up a Wireless Network in Linux Via the Command Line

A walkthrough of wireless (IEEE 802.11 also known as WiFi) home networking with Linux.

Steps

  1. Note that if you are buying a router, all routers are compatible with Linux. It is wireless adapters that have varying levels of Linux compatibility. If your router isn't new, then turn it on and skip to "Detecting your wireless adapter" (below).
  2. Set up your new router.
    • Plug your router into your internet socket if you want to share your internet
    • Plug your router into your PC with an Ethernet cable
  3. Go to your browser and type in the address: "192.168.0.1"
  4. Enter your username and password from your router (often "admin" and "admin") then your internet service provider.
  5. Enable wireless and set your encryption (WEP or WPA) and type a memorable passkey.
  6. Detecting your wireless adapter: Your wireless adapter should be detected automatically by your distribution.
    • Type ifconfig into the terminal to determine whether it's been detected.
      • lshw -C network
  7. Use ndiswrapper, if needed, and your Windows driver.
  8. Connect to a network.
    • sudo ifconfig <interface> down
    • sudo dhclient -r <interface>
    • sudo ifconfig <interface> up
    • sudo iwconfig <interface> essid "ESSID_IN_QUOTES"
    • sudo iwconfig <interface> mode Managed
    • sudo dhclient <interface>
  9. Connecting to a network on boot.
    • Add those commands to /etc/rc.local
      • Make /etc/rc.local executable with chmod

Related Articles

Sources and Citations

  • Ubuntu forums How To: Manual Network Configuration without the need for Network Manager