Linux/Wifi: Difference between revisions

From Wiki
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 25: Line 25:
<pre>
<pre>
ifconfig wlan0 up
ifconfig wlan0 up
</pre>
</blockquote>
* show supported channels
<blockquote>
<pre>
iwlist wlan0 channel
</pre>
</pre>
</blockquote>
</blockquote>
Line 31: Line 38:
<blockquote>
<blockquote>
<pre>
<pre>
iwlist wlan0 scan
iwlist wlan0 scan | grep ESSID
</pre>
</pre>
</blockquote>
</blockquote>


* scan and show channel usage
<blockquote>
<pre>
sudo iwlist wlan0 scan | grep Frequency | sort | uniq -c | sort -n
</pre>
</blockquote>
== configuration ==
* get country information
<blockquote>
<pre>
iw reg get
</pre>
</blockquote>


* set country information
<blockquote>
<pre>
iw reg set DE
</pre>
</blockquote>


* install WPA support
<blockquote>
<pre>
sudo apt install wpasupplicant
</pre>
</blockquote>


* /etc/wpa_supplicant/wpa_supplicant.conf
<blockquote>
<pre>
network={
    ssid="xxxSSIDxxx"
    psk="xxxPASSWORDxxx"
}
</pre>
</blockquote>
* bring interface up
<blockquote>
<pre>
ifconfig wlan0 up
</pre>
</blockquote>
* connect to WPA wifi
<blockquote>
<pre>
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext
# add -B for background
</pre>
</blockquote>
* get IP
<blockquote>
<pre>
dhclient wlan0
</pre>
</blockquote>
* /etc/network/interfaces
<blockquote>
<pre>
allow-hotplug wlan0
iface wlan0 inet dhcp
      wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
</pre>
</blockquote>
== Troubleshooting ==
* airplane mode?
<blockquote>
<pre>
rfkill list all
</pre>
</blockquote>


[[Category:Linux/Network]]
[[Category:Linux/Network]]
[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 19:09, 12 February 2018

Get infos

  • list network hardware
lshw -class network
  • show all network devices
ifconfig -a
  • get wifi information
iwconfig
  • bring interface up
ifconfig wlan0 up
  • show supported channels
iwlist wlan0 channel
  • scan for wifi networks
iwlist wlan0 scan | grep ESSID
  • scan and show channel usage
sudo iwlist wlan0 scan | grep Frequency | sort | uniq -c | sort -n


configuration

  • get country information
iw reg get
  • set country information
iw reg set DE
  • install WPA support
sudo apt install wpasupplicant
  • /etc/wpa_supplicant/wpa_supplicant.conf
network={
    ssid="xxxSSIDxxx"
    psk="xxxPASSWORDxxx"
}
  • bring interface up
ifconfig wlan0 up
  • connect to WPA wifi
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -D wext
# add -B for background
  • get IP
dhclient wlan0
  • /etc/network/interfaces
allow-hotplug wlan0
iface wlan0 inet dhcp
      wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Troubleshooting

  • airplane mode?
rfkill list all