Advertisement
xtree1

pi-kvm wifi systemd.network setup

Feb 1st, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. enter disk write mode
  2. rw
  3.  
  4. find wireless adapter:
  5. commands:
  6. use either
  7. ip a
  8. or
  9. ls /sys/class/net
  10. Pi 4 should be wlan0
  11. create a config file which allows wpa_supplicant to use the network adapter
  12.  
  13. vi /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  14.  
  15. contents:
  16. ctrl_interface=/run/wpa_supplicant
  17. update_config=1
  18. p2p_disabled=1
  19.  
  20. start wap_supplicant
  21.  
  22. wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  23.  
  24. once started use wpa_cli to find and configure wireless
  25. wpa_cli
  26. >
  27. >scan
  28. once scan completes run
  29. >scan_results
  30. Note: this is time sensitive. run scan_results right after scan completes.
  31.  
  32. configure the access point
  33. >add_network
  34. >set_network 0 ssid <ssid>
  35. >set_network 0 psk <wpa_password>
  36. > enable_network 0
  37.  
  38. Kill the wpa process so it can re-read the wpa_supplican-wlan0.conf
  39. pkill wpa
  40.  
  41. Restart the wpa process
  42. wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  43.  
  44. check wlan0 and make sure it is up. Note this just sets the carrier and not the ip address
  45.  
  46. # ip link show wlan0
  47. should return
  48. wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
  49.  
  50. enable wpa_supplicant to start at system start
  51. systemctl enable wpa_supplicant@wlan0.service
  52.  
  53. Setup wlan0 ip address.
  54.  
  55. copy /etc/systemd/network/eth0.network to /etc/systemd/network/wlan0.network
  56. cp /etc/systemd/network/eth0.network /etc/systemd/network/wlan0.network
  57.  
  58. vi /etc/systemd/network/wlan0.network
  59.  
  60. change
  61. [Match]
  62. Name=eth0
  63. to
  64. Name=wlan0
  65.  
  66. If you are using DHCP for eth0 then you are all set. If you set a static IP on eth0 and what DHCP on wifi then change [Network] to use DHCP
  67.  
  68. [Network]
  69. DHCP=yes
  70. DNSSEC=no
  71.  
  72. For a static IP use
  73.  
  74. [Network]
  75. Address=<ip_address>/<mask cidr value> (255.255.255.0 = 24 etc)
  76. Gateway=<gateway ip address>
  77. DNS=<dns 1>
  78. DNS=<dns 2>
  79. DNS=<dns 3>
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement