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

  • Inilah 7 Ide Channel YouTube Aneh Tapi Sederhana yang Bisa Kalian Mulai Sekarang Juga!
  • Apa itu Umroh & Keutamaannya: Inspirasi dari pergiumroh.com
  • Belum Tahu? Gini Caranya Dapat Bisnis Sukses Cuma dari Clipping Video Pake AI
  • Inilah Rahasia Perbaiki Algoritma Video YouTube yang Mulai Sepi
  • Kenapa Cicilan di Bank Syariah Itu Tetap?
  • Inilah 7 Produk Digital Paling Realistis untuk Kalian yang Mau Jualan Online Tahun Ini!
  • Inilah 4 Strategi Memilih Niche SEO Terbaik Supaya Blog Kalian Cepat Ranking
  • Ini Trik Supaya Pengunjung Toko Online Kalian Jadi Pembeli Setia Pakai Omnisend!
  • 3 Strategi AI Terbukti Biar Bisnis E-Commerce Kalian Makin Cuan 2026!
  • Inilah 6 Langkah Tembus 5.000 Follower di X, Gini Caranya Supaya Akun Kalian Nggak Stuck Lagi!
  • SEO LinkedIn: Inilah Alasan Kenapa LinkedIn Ads Lebih Efektif Buat Bisnis B2B Dibanding Platform Lain
  • Inilah Alasan Kenapa Kolom Komentar YouTube Kalian Sering Menghilang Secara Misterius!
  • Cara Kelola Auto-Posting Semua Media Sosial Kalian Pakai Metricool
  • Studi Kasus Sukses Instagram Maria Wendt Dapat 12 Juta View Instagram Per Bulan
  • ZenBook S16, Vivobook Pro 15 OLED, ProArt PX13, dan ROG Zephyrus G14, Laptop Bagus dengan Layar OLED!
  • Caranya Ngebangun Website Directory dengan Traffic Tinggi dalam Seminggu!
  • Cara Mengembangkan Channel YouTube Shorts Tanpa Wajah
  • Inilah Cara Menghitung Diskon Baju Lebaran Biar Nggak Bingung Saat Belanja di Mall!
  • Cara Jitu Ngebangun Bisnis SaaS di Era AI Pakai Strategi Agentic Workflow
  • Inilah Rincian Gaji Polri Lulusan Baru 2026, Cek Perbedaan Jalur Akpol, Bintara, dan Tamtama Sebelum Daftar!
  • Inilah 5 Channel YouTube Membosankan yang Diam-diam Menghasilkan Banyak Uang
  • Inilah Cara Pakai Google Maps Offline Biar Mudik Lebaran 2026 Nggak Nyasar Meski Tanpa Sinyal!
  • Inilah Alasan Mahkamah Agung Tolak Kasasi Google, Denda Rp202,5 Miliar Resmi Menanti Akibat Praktik Monopoli
  • Inilah Cara Daftar dan Syarat SPMB SMK Boarding Jawa Tengah 2026, Sekolah Gratis Sampai Lulus!
  • Inilah Daftar Sekolah Kedinasan 2026 untuk Lulusan SMK, Bisa Kuliah Gratis dan Berpeluang Besar Langsung Jadi CPNS!
  • Inilah Pajak TER: Skema Baru PPh 21 yang Nggak Bikin Pusing, Begini Cara Hitungnya!
  • Inilah Jadwal Resmi Jam Buka Tol Jogja-Solo Segmen Prambanan-Purwomartani Saat Mudik Lebaran 2026
  • Inilah Cara Mendapatkan Witherbloom di Fisch Roblox, Rahasia Menangkap Ikan Paling Sulit di Toxic Grove!
  • Kenapa Indomart Point Bisa Kalahkan Bisnis Kafe?
  • Inilah Cara Mendapatkan Rotten Seed di Fisch Roblox, Lokasi Rahasia di Toxic Grove Buat Unlock Toxic Lotus!
  • How to Fix Taskbar Icon Order in Windows 11/10
  • How to Disable Personalized Ads in Copilot on Windows 11
  • What is the Microsoft Teams Error “We Couldn’t Connect the Call” Error?
  • Why Does the VirtualBox System Service Terminate Unexpectedly? Here is the Full Definition
  • Why is Your Laptop Touchpad Overheating? Here are the Causes and Fixes
  • How to Use Orbax Checkpointing with Keras and JAX for Robust Training
  • How to Automate Any PDF Form Using the Power of Manus AI
  • How to Training Your Own YOLO26 Object Detection Model!
  • How to Build a Full-Stack Mobile App in Minutes with YouWare AI
  • How to Create Consistent Characters and Cinematic AI Video Production with Seedance
  • 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

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