Connecting to a Wi-Fi Network

Note: If you maintain both a wired and Wi-Fi connection at reboot, only the wired connection will be established. If you removed the wired connection, then the Wi-Fi will attempt to connect. Reinserting the wired connection will not change this connection model, unless Wi-Fi drops.

Once the Galileo board is powered up, you should verify the Wi-Fi adapter is connected and working. To do this, run the following Linux commands on your Galileo board, via the serial session described into the Getting Started guide.

root@galileo:# lspci -k | grep -A 3 -i "network"
01:00.0 Network controller: Intel Corporation Centrino Wireless-N 135 (rev c4)
		Subsystem: Intel Corporation Centrino Wireless-N 135 BGN
		Kernel driver in use: iwlwifi

The IoTDK contains the embedded connection manager connman[4], which we will use here to establish the Wi-Fi connection. To interface with connman, we will use the command connmanctl.

root@galileo:# connmanctl
  connmanctl> enable wifi
	Enabled wifi
  connmanctl> scan wifi
	Scan completed for wifi
  connmanctl> services
	*AO Wired  ethernet_000000000000_cable 	  
      MyNET1     wifi_dc85de828967_38303944616e69656c74_managed_psk
	OtherNet2  wifi_dc85de828967_3257495245363836_managed_wep
      [...]

After running these commands, you’ll see your wireless network name (not “MyNET1”). Note that in case of a hidden network, there network will be listed without a name preceding it. If “MyNET1” was hidden, the output could be:

  connmanctl> services
	*AO Wired  ethernet_000000000000_cable 	  
      	wifi_dc85de828967_38303944616e69656c74_hidden_managed_psk
      [...]

To connect to a secure Wi-Fi network, we need to turn on the agent that allows user interaction on the console. For example, to connect to MyNet1 you would type:

  connmanctl> agent on
	Agent registered

  connmanctl> connect wifi_dc85de828967_38303944616e69656c74_managed_psk 
	Agent RequestInput wifi_0cd2926de3ae_486f6d65574c414e_managed_psk
	  Passphrase = [ Type=psk, Requirement=mandatory ]
	Connected wifi_dc85de828967_38303944616e69656c74_managed_psk 
	Passphrase? <passphrase goes here>

Enter the passphrase for MyNet1, then wait for the connection to be established.

[  928.015714] wlp1s0: authenticate with aa:bb:cc:dd:ee:ff
[  928.060155] wlp1s0: capabilities/regulatory prevented using AP HT/VHT configuration, downgraded
[  928.079977] wlp1s0: send auth to aa:bb:cc:dd:ee:ff (try 1/3)
[  928.087854] wlp1s0: authenticated
[  928.100157] wlp1s0: associate with aa:bb:cc:dd:ee:ff (try 1/3)
[  928.116202] wlp1s0: RX AssocResp from aa:bb:cc:dd:ee:ff (capab=0x431 status=0 aid=3)
[  928.129111] wlp1s0: associated
[  928.132339] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0: link becomes ready

Then you can exit the connman console and check the IP address allocation for Wi-Fi connections.

connmanctl> quit

root@galileo:# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s20f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:13:20:ff:14:43 brd ff:ff:ff:ff:ff:ff
    inet 169.254.5.1/16 brd 169.254.255.255 scope link enp0s20f6:avahi
    inet6 fe80::213:20ff:feff:1443/64 scope link
       valid_lft forever preferred_lft forever
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq qlen 1000
    link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brd 192.168.0.255 scope global wlp1s0
    inet6 fe80::ed2:92ff:fe6d:f1d2/64 scope link
       valid_lft forever preferred_lft forever

Another way you can check Wi-Fi settings is to use the cat command:

root@galileo:# cat  /var/lib/connman/wifi_dc85de828967_38303944616e69656c74_managed_psk /settings
[wifi_0cd2926de3ae_486f6d65574c414e_managed_psk]
Name=MyNET1
SSID=1234567d901234
Frequency=2472
Favorite=true
AutoConnect=true
Modified=2014-06-10T15:08:25.877365Z
Passphrase=intel123
IPv4.method=dhcp
IPv4.DHCP.LastAddress=192.168.0.2
IPv6.method=auto
IPv6.privacy=disabled
Proxy.URL=http://192.168.0.15/proxy.pac
For more complete information about compiler optimizations, see our Optimization Notice.