Browse code

Added steps to configure wireless networks

Change-Id: I23bb5173b1b206a369fa676d9f46f9c7f05e96e0
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6604
Reviewed-by: Keerthana K <keerthanak@vmware.com>
Reviewed-by: Stuart Clements <sclements@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>

Vidya Vasudevan authored on 2019/01/28 23:12:19
Showing 4 changed files
... ...
@@ -108,7 +108,9 @@
108 108
         -   [Installing the Packages for tcpdump and netcat with tdnf](photon_admin/installing-the-packages-for-tcpdump-and-netcat-with-tdnf.md)
109 109
         - [Network Configuration Manager - C API](photon_admin/netmgr.c.md)
110 110
         - [Network Configuration Manager - Python API](photon_admin/netmgr.python.md)
111
-    -   [Cloud-Init on Photon OS](photon_admin/cloud-init-on-photon-os.md)
111
+    - [Configure Wireless Networking](photon_admin/configure-wireless-networking.md)
112
+    - [Prioritize eth0 Route Over wlan0](photon_admin/prioritize-eth0-route-over-wlan0.md)   
113
+    - [Cloud-Init on Photon OS](photon_admin/cloud-init-on-photon-os.md)
112 114
         - [Cloud-Init Overview](photon_admin/cloud-init.md)
113 115
         - [Deploy Photon OS With cloud-init](photon_admin/deploy_photon_with_cloud-init.md) 
114 116
         - [Creating a Stand-Alone Photon Machine with cloud-init](photon_admin/creating-a-stand-alone-photon-machine-with-cloud-init.md)
... ...
@@ -48,7 +48,9 @@
48 48
     -   [Installing the Packages for tcpdump and netcat with `tdnf`](installing-the-packages-for-tcpdump-and-netcat-with-tdnf.md)
49 49
     - [Network Configuration Manager - C API](netmgr.c.md)
50 50
     - [Network Configuration Manager - Python API](netmgr.python.md)        
51
--   [Cloud-Init on Photon OS](cloud-init-on-photon-os.md)
51
+- [Configure Wireless Networking](configure-wireless-networking.md)
52
+- [Prioritize eth0 Route Over wlan0](prioritize-eth0-route-over-wlan0.md) 
53
+- [Cloud-Init on Photon OS](cloud-init-on-photon-os.md)
52 54
     - [Cloud-Init Overview](cloud-init.md)
53 55
     - [Deploy Photon OS With cloud-init](deploy_photon_with_cloud-init.md)
54 56
     - [Creating a Stand-Alone Photon Machine with cloud-init](creating-a-stand-alone-photon-machine-with-cloud-init.md)
55 57
new file mode 100644
... ...
@@ -0,0 +1,78 @@
0
+# Configure Wireless Networking
1
+
2
+You can configure wireless networking in Photon OS. Connect to an open network or a WPA2 protected network using `wpa_cli` and configure `systemd-networkd` to assign an IP address to the network.
3
+
4
+* [Connect using `wpa_cli`](#connect-using-wpa-cli)
5
+* [Assign IP address to network](#assign-ip-address-to-network)
6
+
7
+## Connect Using wpa_cli
8
+
9
+When you connect using `wpa_cli`, you can scan for available networks and associate the network with a network ID. 
10
+
11
+Perform the following steps:
12
+
13
+1. Ensure that the `wpa_supplicant service` is running on the WLAN interface:
14
+
15
+    `Systemctl status wpa_supplicant@<wlan-interface>.service`
16
+
17
+1. Connect to `wpa_cli`:
18
+    
19
+    `wpa_cli -i wlan0`
20
+
21
+1. Scan for available networks:
22
+
23
+    `scan`
24
+
25
+1. To see the list of networks, use the following command:
26
+    
27
+    `scan_results`
28
+
29
+1. Add the network:
30
+
31
+    `add_network`
32
+    
33
+    This command returns a network ID. 
34
+
35
+1. Associate the network with the network ID. 
36
+
37
+    `set_network  <network ID> ssid “<ssid-name>”`
38
+    
39
+1. For a WPA2 network, set the passphrase:
40
+
41
+    `set_network <network ID> psk “<passphrase>”`
42
+    
43
+1. Enable the network:
44
+
45
+    `enable_network <network ID>`
46
+    
47
+1. Save the configuration file: 
48
+
49
+    `save_config`
50
+    
51
+    To exit the `wpa_cli`, type 'quit`. 
52
+
53
+
54
+## Assign IP Address To Network
55
+
56
+Configure `systemd-networkd` to assign IP address to network. Perform the following steps:
57
+
58
+
59
+1. Create a `/etc/systemd/network/98-dhcp-wlan.network` file with the following contents:
60
+    
61
+    ```
62
+    [Match]
63
+    Name=wlan*
64
+    [Network]
65
+    DHCP=yes
66
+    IPv6AcceptRA=no
67
+    ```
68
+
69
+1. Restart systemd-networkd using:
70
+
71
+    `Systemctl restart systemd-networkd`
72
+
73
+
74
+
75
+
76
+
77
+
0 78
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+# Prioritize eth0 Route Over wlan
1
+
2
+You can prioritise the eth0 route over the wlan route. Perform the following steps:
3
+
4
+1. Modify the `/etc/systemd/network/99-dhcp-en.network` file and add the following content:
5
+
6
+    ```
7
+    [DHCP]
8
+    RouteMetric=512
9
+    ```
10
+
11
+1. Restart `systemd-networkd`.