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

  • Cara Dapat Diamond Free Fire Gratis 2026, Pemain FF Harus Tahu!
  • Inilah Cara Mengisi Presensi EMIS GTK IMP 2026 Terbaru Biar Tunjangan Lancar
  • Inilah Trik Hashtag Viral Supaya Video Shorts Kalian Nggak Sepi Penonton Lagi
  • Inilah Jawabannya, Apakah Zakat Fitrah Kalian Bisa Mengurangi Pajak Penghasilan?
  • Inilah Caranya Supaya Komisi TikTok dan Shopee Affiliate Tetap Stabil Pasca Ramadhan!
  • Inilah 10 Kesalahan Fatal Saat Beli Properti yang Bisa Bikin Kalian Bangkrut!
  • Belum Tahu Cara Masuk Simpatika Terbaru? Ini Cara Login PTK EMIS GTK IMP 2026 Supaya Cek TPG Jadi Lebih Gampang!
  • Inilah Cara Bikin Konten Animasi AI Cuma Modal HP Supaya Bisa Gajian Rutin dari YouTube
  • Inilah Alasan Kenapa Zakat ke Ormas yang Belum Diakui Negara Nggak Bisa Dipakai Buat Ngurangin Pajak!
  • Inilah Cara Belanja di Indomaret Pakai Shopee PayLater yang Praktis dan Bikin Hemat!
  • Inilah 10 Jurusan Terfavorit di Universitas Negeri Semarang Buat SNBT 2026, Saingannya Ketat Banget!
  • Belum Tahu? Inilah Cara Mudah Membuat Akun dan Login EMIS GTK IMP 2026 yang Benar!
  • Cara Dapat Kode Kartu Hadiah Netflix Gratis Tanpa Ribet
  • Inilah Caranya Dapet Bukti Setor Zakat Resmi dari NU-Care LazisNU Buat Potong Pajak di Coretax!
  • Inilah 10 Jurusan Terfavorit di Universitas Brawijaya Buat SNBT 2026, Saingannya Ketat Banget!
  • Inilah Cara Terbaru Login dan Ubah Password Akun PTK di EMIS GTK IMP 2026
  • Inilah Batas Maksimal Zakat untuk Pengurang Pajak, Ternyata Begini Aturannya!
  • Inilah Cara Mengenali Aplikasi Bodong Penghasil Uang Agar Kalian Nggak Jadi Korban Penipuan Digital
  • Apa itu Error Kode LADK3 saat Buka Rekening Brimo? Dan Solusinya!
  • BOHONG??? Inilah Rincian Anggaran Makan Bergizi Gratis, Ternyata Uang Bahan Makanannya Nggak Sampai Rp15.000!
  • Inilah Tugas Proktor Ujian TKA SD/SMP 2026, Baca Dulu Ada Yang Beda!
  • Tips Pajak Coretax: Inilah Cara Memastikan Lembaga Amil Zakat yang Sah Agar Pajak Kalian Berkurang!
  • Kenapa FreeFire Advance Server Tidak Bisa Diunduh? Ini Penjelasannya!
  • Inilah Realita Biaya Hidup Mahasiswa di Bogor: Ternyata Nggak Semahal yang Kalian Kira!
  • Inilah Cara Blokir Email Spam di Gmail Biar Penyimpanan Nggak Gampang Penuh
  • Inilah Cara Aktivasi Keaktifan PTK di EMIS GTK IMP 2026 Biar Tunjangan Cair Lancar!
  • Inilah Cara Menilai Sumbangan yang Disetarakan dengan Uang Supaya Pajak Kalian Berkurang
  • Apa itu Pin di iMessage?
  • SKTP Nggak Muncul di Info GTK padahal Sudah Terbit? Ini Trik Rahasia Biar Data Langsung Update!
  • Ini Trik Nuyul Cari Cuan di Game Puzzle Farm 2026 Biar Koin Melimpah Tanpa Undang Teman
  •  How to Fix Microsoft 365 Deployment Tool Not Working: A Complete Troubleshooting Guide
  •  How to Fix Windows 11 ISO Download Blocked and Error Messages
  • How to Make Your Website Vibrate with Web Haptics
  • Measuring LLM Bullshit Benchmark
  • A Step-by-Step Guide to ZITADEL Identity Infrastructure
  • How to Automate Your Business Intelligence with Google Antigravity and NotebookLM
  • The Secret Reason Seedance 2.0 is Realistic
  • Exploring Microsoft Phi-4 Reasoning Vision 15B
  • Gemini 3.1 Flash-Lite Released: How to Master Google’s Fastest AI Model for Real-World Projects
  • Qwen Is Ruined! Why the Masterminds Behind Qwen 3.5 Left Alibaba Cloud
  • 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