Guest User

Untitled

a guest
Feb 9th, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. # Install helper to speed up getting random numbers for encryption
  2. rpi ~$ sudo -Es
  3. rpi ~# apt install rng-tools
  4.  
  5. # disable classic networking
  6. rpi ~# systemctl mask networking.service
  7. rpi ~# systemctl mask dhcpcd.service
  8. rpi ~# mv /etc/network/interfaces /etc/network/interfaces~
  9. rpi ~# sed -i '1i resolvconf=NO' /etc/resolvconf.conf
  10.  
  11. # enable systemd-networkd
  12. rpi ~# systemctl enable systemd-networkd.service
  13. rpi ~# systemctl enable systemd-resolved.service
  14. rpi ~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
  15.  
  16. rpi ~# cat > /etc/systemd/network/08-wlan0.network <<EOF
  17. [Match]
  18. Name=wlan0
  19. [Network]
  20. Address=192.168.50.60/24
  21. EOF
  22.  
  23. iw wlan0 set type ibss
  24. iw wlan0 ibss join RPiNet 2412 # frequency 2412 is channel 1
  25.  
  26. rpi ~# systemctl --force --full edit ad-hoc-interface@wlan0.service
  27.  
  28. [Unit]
  29. Description=Unprotected ad-hoc (IBSS) interface
  30. Requires=sys-subsystem-net-devices-%i.device
  31. After=sys-subsystem-net-devices-%i.device
  32. Wants=network.target
  33. Before=network.target
  34.  
  35. [Service]
  36. Environment="SSID=IBSS-RPiNet" "FREQUENCY=2412"
  37. Type=oneshot
  38. RemainAfterExit=yes
  39. ExecStartPre=/sbin/iw %I set type ibss
  40. ExecStart=/sbin/iw %I ibss join $SSID $FREQUENCY
  41. ExecStopPost=-/sbin/iw dev %I ibss leave
  42. ExecStopPost=-/sbin/iw %I set type managed
  43.  
  44. [Install]
  45. WantedBy=network.target
  46.  
  47. rpi ~# systemctl enable ad-hoc-interface@wlan0.service
  48.  
  49. rpi ~$ iw dev
  50. rpi ~$ iw dev wlan0 link
  51. rpi ~$ ip addr
  52. rpi ~$ sudo iw dev wlan0 scan | grep -B8 -A3 "SSID: IBSS-RPiNet"
  53.  
  54. rpi ~$ sudo systemctl stop ad-hoc-interface@wlan0.service
  55. rpi ~$ sudo systemctl start ad-hoc-interface@wlan0.service
  56.  
  57. rpi ~$ sudo systemctl --full edit ad-hoc-interface@wlan0.service
  58.  
  59. rpi ~$ sudo -Es
  60. rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
  61. country=DE
  62. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  63. update_config=1
  64.  
  65. ap_scan=2
  66. network={
  67. ssid="IBSS-RPiNet"
  68. frequency=2412
  69. mode=1
  70. key_mgmt=NONE
  71. }
  72. EOF
  73.  
  74. 1pi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  75. rpi ~# systemctl enable wpa_supplicant@wlan0.service
  76.  
  77. rpi ~# systemctl edit wpa_supplicant@wlan0.service
  78.  
  79. [Service]
  80. ExecStart=
  81. ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dwext -i%I
  82.  
  83. rpi ~$ iw dev
  84. rpi ~$ iw dev wlan0 link
  85. rpi ~$ ip addr
  86. rpi ~$ sudo iw dev wlan0 scan | grep -B8 -A3 "IBSS-RPiNet"
  87.  
  88. rpi ~$ sudo -Es
  89. rpi ~# iw wlan0 set type ibss
  90. rpi ~# ip link set wlan0 up
  91. rpi ~# iw wlan0 ibss join RPiNet 2432
  92. rpi ~# ip addr add 192.168.1.2 dev wlan0
  93. rpi ~# ip route add 192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.2
  94. rpi ~# exit
  95.  
  96. rpi ~$ # check with:
  97. rpi ~$ iw dev
  98. rpi ~$ iw dev wlan0 link
  99. rpi ~$ ip addr
  100. rpi ~$ sudo iw dev wlan1 scan | grep -B8 -A3 "SSID: RPiNet"
  101.  
  102. rpi ~$ iw dev
  103. phy#0
  104. Unnamed/non-netdev interface
  105. wdev 0x2
  106. addr 86:50:89:38:f2:93
  107. type P2P-device
  108. txpower 31.00 dBm
  109. Interface wlan0
  110. ifindex 3
  111. wdev 0x1
  112. addr b8:27:eb:06:e8:8b
  113. type managed
  114. channel 34 (5170 MHz), width: 20 MHz, center1: 5170 MHz
  115. txpower 31.00 dBm
  116.  
  117. Jul 07 22:06:17 wpa_supplicant[262]: nl80211: Failed to set interface into IBSS mode
  118. Jul 07 22:06:17 wpa_supplicant[262]: wlan0: Association request to the driver failed
  119.  
  120. rpi ~$ systemctl cat wpa_supplicant@wlan0.service | grep '^ExecStart='
  121. ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl80211,wext -i%I
  122.  
  123. rpi ~$ zcat /usr/share/doc/wpa_supplicant/examples/wpa_supplicant.conf.gz | grep -A10 '^# IBSS/ad-hoc network with RSN'
  124.  
  125. rpi ~$ sudo -Es
  126. rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
  127. country=DE
  128. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  129. update_config=1
  130.  
  131. # use 'ap_scan=2' on all devices connected to the network
  132. # this is unnecessary if you only want the network to be created when no other networks are available
  133. ap_scan=2
  134.  
  135. network={
  136. ssid="RPiNet"
  137. key_mgmt=WPA-PSK
  138. proto=RSN
  139. psk="verySecretPassword"
  140. mode=1
  141. frequency=2432
  142. pairwise=CCMP
  143. group=CCMP
  144. }
  145. EOF
  146.  
  147. 1pi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  148. rpi ~# systemctl disable wpa_supplicant.service
  149. rpi ~# systemctl enable wpa_supplicant@wlan0.service
  150.  
  151. wpa_supplicant[262]: random: Cannot read from /dev/random: Resource temporarily unavailable
  152. wpa_supplicant[262]: random: Only 18/20 bytes of strong random data available from /dev/random
  153. wpa_supplicant[262]: random: Not enough entropy pool available for secure operations
  154. wpa_supplicant[262]: WPA: Not enough entropy in random pool to proceed - reject first 4-way handshake
  155.  
  156. rpi ~# apt install rng-tools
  157.  
  158. wlan0: CTRL-EVENT-EAP-FAILURE EAP authentication failed
Add Comment
Please, Sign In to add comment