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

  • Mau Gaji Dolar? Gini Caranya Tembus Kerja di Australia, Jangan Sampai Salah Visa!
  • Belum Tahu? Inilah Fakta MigoReels, Katanya Nonton Drama Bisa Dapat Rp700 Ribu!
  • Apa Itu Event Invite Friends CapCut? Ini Pengertian dan Cara Kerjanya Biar Cuan
  • Apa Itu MJ di FF? Ini Pengertian, Asal-Usul, dan Risiko di Balik Istilah Tersebut
  • Apa Itu Pengertian Penonaktifan SPayLater? Ini Durasi Blokir Akibat Telat Bayar
  • Apa Itu Rasio Gambar Ukuran 1:1 di Canva? Ini Pengertian dan Cara Buatnya
  • Pengiriman Shopee Express Hemat itu Berapa Lama? Ini Pengertian dan Estimasi Sampainya
  • Android 2025: Aplikasi Baru dan Smartphone Impian yang Akan Datang!
  • Apa Itu Google AI Pro Ultra? Ini Pengertian dan Penjelasan Lengkapnya
  • Apa Itu Error Gagal Kirim Nilai RDM 3.1? Ini Pengertian dan Solusi Mengatasinya
  • Facebook Mulai Batasi Link Eksternal Cuma 2 Sebulan! Ini Trik Mengatasinya
  • Cara Nonton Tensura Season 4! Bakal Tayang April 2026 dengan Format 5 Cour
  • Belum Tahu? Inilah Trik Supaya Live TikTok Kalian Aman dan Banjir Cuan
  • Pixel 8 Dapatkan Mode Panorama Baru! Hasil Foto Lebih Luas & Lebih Kreatif
  • Apa Itu AppLocker? Ini Pengertian dan Cara Mengamankan Windows 11 Kalian dari Skrip Jahat
  • Cara Membuat Riwayat Copilot Kamu Tetap Bersih dan Rapi!
  • Game & Aplikasi Android Terbaik Saat Diskon Liburan Natal! Jangan Ketinggalan!
  • Apa Itu Game Prison Escape Journey? Ini Pengertian dan Cara Mainnya untuk Pemula
  • “Listrik Gratis” dari Solar Panel Cuma Mitos?! Ini Sisi Gelap PLTS
  • Samsung Galaxy Z-Fold: Uji Jatuh Bebas yang Mengguncang Keandalan Lipatannya
  • Google One 2026: Apa yang Akan Jadi Fitur Utama dan Harga yang Diharapkan?
  • Apa Itu Error 0x800704f8? Ini Pengertian dan Cara Mengatasinya
  • Android Akhirnya Dapat GPS Darurat di India! Setelah Hampir 10 Tahun
  • Apa Itu GetContact Premium? Ini Pengertian dan Cara Daftarnya
  • Android Maze Figure: Koleksi Baru Google yang Bikin Penggemar Bergairah!
  • Google Update Besar-besaran Desember 2025: Apa yang Akan Memengaruhi Pengalaman Anda?
  • Masih Pusing Hitung Gaji Manual? Waktunya Pakai Aplikasi HR
  • Apa Itu Dustruco? Ini Pengertian dan Cara Pasangnya di HP Kalian
  • Apa Itu Aplikasi Dooie Live? Ini Pengertian dan Cara Pakai Aplikasinya untuk Cari Jodoh
  • Apa Itu Battle Emote Jefri Nichol dan Om Telolet Om di MLBB? Ini Penjelasannya
  • Apa itu Cosmic Desktop: Pengertian dan Cara Pasangnya di Ubuntu 26.04?
  • Apa Itu Auvidea X242? Pengertian Carrier Board Jetson T5000 dengan Dual 10Gbe
  • Elementary OS 8.1 Resmi Rilis: Kini Pakai Wayland Secara Standar!
  • Apa Itu Raspberry Pi Imager? Pengertian dan Pembaruan Versi 2.0.3 yang Wajib Kalian Tahu
  • Performa Maksimal! Ini Cara Manual Update Ubuntu ke Linux Kernel 6.18 LTS
  • Apa Itu PeakAI? Ini Pengertian dan Cara Menghasilkan Uang dari Kolaborasi TikTok
  • Inilah Cara Ubah Rutinitas Browsing Lebih Produktif dengan Perplexity Comet (AI Browser)
  • Inilah Cara Kuasai Materi Sulit dalam Hitungan Menit Pakai Google NotebookLM: Tutorial Lengkap
  • Inilah Cara Membuat AI Agent Cerdas dan Memantaunya Menggunakan LangGraph dan LangSmith
  • Ini Alasan China Akan Menang di Dunia AI
  • Apa Itu Raccoon Framework? Ini Pengertian dan Asal Usulnya
  • Apa Itu Serangan Phishing OAuth di Microsoft 365? Ini Definisi dan Cara Kerjanya
  • Apa Itu Distribusi Malware Via YouTube? Ini Pengertian dan Bahayanya Buat Kalian
  • Apa Itu Undang-Undang NDAA? Ini Pengertian dan Dampaknya Bagi Cyber Command Amerika Serikat
  • Tagihan AWS Sekarang Bisa Dibayar Pakai BNB via BPN, Ini Caranya!
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

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