Wireless

From krtkl wiki
Jump to navigation Jump to search

Bringing up Wireless Interface

The wireless interface (most commonly wlan0) can be brought up with:

ifconfig <interface> up

To check the naming of the interfaces available, including those that have yet to be brought up, the -a flag can be used.

$ ifconfig -a
lo        Link eoopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:IPv6-in-IPv4  
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropps:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr e0:e5:cf:00:ff:22  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Wireless Naming Rules

The wireless naming will automatically be enumerated by udev based on hardware address within /etc/udev/rules.d/70-persistent-net.rules. udev will create a new and unique name for the interface if it is not listed within this rules file. This will ensure that the interface name will always be the same when the system boots up. Removing the list of interfaces from within this file will cause udev to regenerate interface names on the next reboot. In the following example, a name of "wlan0" has been given to the wireless interface:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# Unknown net device (/devices/amba.2/e000b000.ps7-ethernet/net/eth0) (xemacps)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0a:35:00:01:22", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# Unknown net device (/devices/soc0/amba/e0101000.sdhci/mmc_host001/mmc1:0001:2/wl18xx.0.auto/net/wlan0) (wl18xx_driver)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e0:e5:cf:00:ff:22", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

If the


Wireless Bringup on Boot

The wireless interface bring-up behaviour can be configured within /etc/network/interfaces.d.

Connecting to Networks (wpa_supplicant)

A network connection can be established by starting the wpa_supplicant daemon. The WPA supplicant requires a configuration file with a list of network configurations to use for connection.

$ wpa_supplicant -B -Dnl80211 -iwlan1 -c/etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant

Checking Network Connection

iw dev <interface> link

If connected to a network the output will show the details of the connection:

$ iw dev wlan0 link
Connected to 12:34:56:78:9a:bc (on wlan0)
	SSID: MyNetwork
        freq: 2437
        RX: 32843 bytes (117 packets)
        TX: 1303 bytes (12 packets)
        signal: -44 dBm
        tx bitrate: 150.0 MBit/s MCS 7 40MHz short GI

        bss flags:      short-preamble short-slot-time
        dtim period:    1
        beacon int:     100


$ iw dev wlan0 link
Not connected.

Getting an IP Address (dhclient)

dhclient <interface>


Checking IP Address and Connectivity

Checking Interface Configuration/Connection (ifconfig)

$ ifconfig
wlan1     Link encap:Ethernet  HWaddr e0:e5:cf:00:ff:22  
          inet addr:10.0.111.160  Bcast:10.0.111.255  Mask:255.255.255.0
          inet6 addr: fe80::e2e5:cfff:fe00:ff22/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:201 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:54949 (54.9 KB)  TX bytes:1526 (1.5 KB)


Checking Internet Connection (ping)

$ ping google.com
PING google.com (216.58.194.206) 56(84) bytes of data.
64 bytes from sfo03s01-in-f14.1e100.net (216.58.194.206): icmp_seq=1 ttl=54 time=18.0 ms