Skip to content

emka.web.id

menulis pengetahuan – merekam peradaban

Menu
  • Home
  • Tutorial
  • Search
Menu

Belajar Linux: How to Connect to Wi-Fi from Command Line

Posted on June 9, 2013

We will talk about how to connect to Non-Secured Networks, as well as WEP and WPA protected networks. This tutorial will not cover how to install the drivers for your wireless card. Most old cards will be automatically detected by your system, but in the unfortunate event that it won’t be detected, you will have to do a lot of digging.

To follow this tutorial you need the following packages already installed on your system:

  1. iwconfig
  2. iwlist
  3. wpa_passphrase

In Arch Linux, these are all part of the wireless_tools pack (if it’s of any help… probably not… unless you use Arch)

With that said, let’s get started, these commands need to be run as root, or with root privileges using the sudo command.

Use this line to check if your OS has loaded the card driver:

lspci | grep -i net

Now, run this command to make sure the driver has created an interface for the kernel to use:

iwconfig

If you only have one wireless card, it will probably be named “wlan0″. First of all we need to turn it on, so we will do just that:

ip link set wlan0 up

Now, connecting to any wireless network requires 2 things. The name of the network (a.k.a. the ESSID) and the password if it’s a password protected network (like WPA or WEP). If you don’t know the ESSID of your network, you can issue the following to get a list of all the networks in range.

iwlist wlan0 scan

Now, the following instructions are for networks with WPA security ONLY. If you have WEP security or No Security at all (a.k.a. No Password), skip these steps. WPA security requires that the ESSID and the password be stored in a file  on your system, this file is called “wpa_supplicant.conf”. First and foremost we will make a backup of the old file in case we break something:

 mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.original

And then we create a new file to match our needs:

wpa_passphrase network_name “secret_passkey” > /etc/wpa_supplicant.conf

The file stores everything in plain text format, therfore it’s a good idea to make this file readable only from the root account. To do this run the following command.

chmod 0600 /etc/wpa_supplicant.conf

Everybody follow along from this point. We will connect the computer to the wireless router. Use the command in the table below that best suits your situation:

Encryption Command
No Encryption iwconfig wlan0 essid "linksys"
WEP w/ Hex Key iwconfig wlan0 essid "linksys" key "0241baf34c"
WEP w/ ASCII passphrase iwconfig wlan0 essid "linksys" key "s:pass1"
WPA wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf

WARNING! In my situation, not sure why, it was necessary to run the same command a second time to properly connect to the router, otherwise it wouldn’t work. So the way I do it is connect to the router, wait 3 seconds, than do the same thing again and it all works fine. To test if you are connected to the router just issue:

iwconfig wlan0

Now, in most cases wirless access points also double as DHCP servers so the following command will allow your system to request an IP address from the router and set itself up with the received information:

dhcpcd wlan0

If you are one of the rare cases in which you have to assign your own ip address, this line will do the trick nicely:

ifconfig wlan0 192.168.9.100 netmask 255.255.255.0

Now, just run a ping to test if the connection is working:

ping -c 3 www.google.com

And that should be it! Ready to surf. If anyone runs into any problems or has a better way of doing this don’t be hateful, be helpful instead and lave a comment with your solution. That’s what the Linux community is all about isn’t it?

Terbaru

  • Apa tiu Keberagaman? dan Kenapa Kita Butuh Perbedaan
  • Inilah Rekomendasi Tablet RAM 8 GB Paling Murah 2026 Buat Kerja dan Kuliah!
  • Ini Bocoran Honorable Mention TOTY FC Mobile OVR 117 dan 34 Kode Redeem Paling Baru!
  • Inilah Cara Memilih Smartband GPS Terbaik Biar Olahraga Kalian Makin Efektif!
  • Cara Cek Garansi iPhone dengan Benar, Penting Banget Buat yang Mau Beli HP Baru atau Bekas!
  • Inilah Infinix Note 60 Pro, HP Midrange yang Punya Desain Mirip iPhone dan Fitur Unik ala Nothing Phone!
  • Cara Mengatasi Digi Bank BJB Error dan Nggak Bisa Dibuka!
  • Inilah Kronologi & Kenapa Link Video Viral Andira McQueen di Dalam Mobil yang Bikin Geger Netizen Makassar
  • Cara Input Dapodik 2026 Biar Sekolah Masuk Prioritas Revitalisasi 2026
  • Apa Itu Kurikulum Berbasis Cinta (KBC)? Ini Penjelasan dan Cara Penerapannya
  • Inilah Cara Mengurus SKTM KIP Kuliah 2026 yang Benar Agar Lolos Seleksi!
  • Kapan Waktu Resmi Jam Maintenance Livin Mandiri?
  • WiFi Sudah Nyambung Tapi Internet Kok Nggak Jalan? Ini Cara Supaya Koneksi Kalian Lancar Lagi!
  • Inilah Kumpulan Cheat GTA San Andreas Terlengkap 2026!
  • Belum Kebagian Tiket Mudik? Inilah Bocoran Jadwal Tiket Kereta Tambahan Lebaran 2026!
  • Apa itu Pengertian Web Scraping?
  • Cara Isi Instrumen Pengelolaan Pengawas TKA Lancar Jaya Tanpa Masalah
  • Cara Isi Instrumen MBG di Healthy Madrasah/EMIS Tahun 2026
  • Inilah Cara Mengatasi Rekening Tidak Valid di Info GTK 2026 Biar Tunjangan Cair
  • Cara Isi Observasi Kinerja Kepala Sekolah di Ruang GTK 2026, Biar Nggak Bingung Lagi!
  • Inilah Cara Atasi SKTP Januari-Februari 2026 yang Belum Muncul di Info GTK
  • Pusing Rekening Info GTK Silang Merah? Tenang, Ini Cara Mengatasinya Biar Tunjangan Kalian Cepat Cair!
  • Cara Jadi Lebih Sehat Dengan Ponsel Pintar Kalian
  • WA Kini Coba Fitur Web App untuk Panggilan
  • Google Meluncurkan Pembaruan Sistem Besar Februari 2026
  • Discord Tambahkan Verifikasi Usia: Apa Artinya?
  • Telegram Rilis Desain Baru untuk Android dengan Efek Liquid Glass, Sudah Tersedia!
  • Google Home: Perbaikan Lama yang Bisa Membuat Pengalaman Lebih Baik
  • Google Gemini di Chrome Kini Hadir untuk Chromebook dan Laptop Plus
  • YouTube Music Kini Tambah Fitur Lirik Lagu, Premium Wajib Tahu!
  • Crossover 26 Released: New Features for Linux Users
  • Cosmic Desktop 1.0.6 Released: What’s New for Linux Users?
  • MOS: A New Open-Source OS for Home Labs and Self-Hosting
  • Windows 11 Dock Test: Linux/MacOS Style via PowerToys
  • Microsoft Ends 3D Viewer in Windows 11, Creators Update Era Over
  • Prompt AI Merubah Postingan LinkedIn Jadi Ladang Diskusi dengan ChatGPT
  • Prompt AI: Paksa Algoritma LinkedIn Promosikan Konten Kalian
  • Inilah Cara Bikin Postingan Viral Menggunakan AI
  • Inilah Cara Buat Conversation Starter di Claude Project Agar Workflow Kalian Lebih Sat-Set
  • Cara Membuat Knowledge Base Audit untuk Claude Project Agar Dokumen Kalian Nggak Berantakan
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
Beli Pemotong Rumput dengan Baterai IRONHOOF 588V Mesin Potong Rumput 88V disini https://s.shopee.co.id/70DBGTHtuJ
Beli Morning Star Kursi Gaming/Kantor disini: https://s.shopee.co.id/805iTUOPRV

©2026 emka.web.id | Design: Newspaperly WordPress Theme