SHARE
TWEET

Untitled

a guest Aug 18th, 2018 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # enable journaling
  2. rpi ~$ sudo -Es
  3. rpi ~# mkdir -p /var/log/journal
  4. rpi ~# systemd-tmpfiles --create --prefix /var/log/journal #ignore warnings (*)
  5.  
  6. # disable classic networking
  7. rpi ~# systemctl mask networking.service
  8. rpi ~# systemctl mask dhcpcd.service
  9. rpi ~# sudo mv /etc/network/interfaces /etc/network/interfaces~
  10. rpi ~# sed -i '1i resolvconf=NO' /etc/resolvconf.conf
  11.  
  12. # enable systemd-networkd
  13. rpi ~# systemctl enable systemd-networkd.service
  14. rpi ~# systemctl enable systemd-resolved.service
  15. rpi ~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
  16.    
  17. rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
  18. country=DE
  19. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  20. update_config=1
  21.  
  22. ap_scan=2
  23. network={
  24.     ssid="RPiNet"
  25.     mode=2
  26.     key_mgmt=WPA-PSK
  27.     psk="password"
  28.     frequency=2437
  29. }
  30. EOF
  31.    
  32. rpi ~# systemctl enable wpa_supplicant@wlan0.service
  33.    
  34. rpi ~# cat > /etc/systemd/network/04-eth0.network <<EOF
  35. [Match]
  36. Name=eth0
  37. [Network]
  38. DHCP=yes
  39. IPForward=yes
  40. EOF
  41.  
  42. rpi ~# cat > /etc/systemd/network/08-wlan0.network <<EOF
  43. [Match]
  44. Name=wlan0
  45. [Network]
  46. Address=192.168.4.1/24
  47. DHCPServer=yes
  48. EOF
  49.    
  50. rpi ~# systemctl edit wpa_supplicant@wlan0.service
  51.    
  52. [Service]
  53. ExecStartPre=/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  54. ExecStopPost=/sbin/iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
  55.    
  56. rpi ~$ sudo ip route add 192.168.4.0/24 via 192.168.0.2 dev eth0
  57.    
  58. rpi ~$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  59.    
  60. rpi ~$ sudo -Es
  61. rpi ~# cat > /etc/systemd/network/02-br0.netdev <<EOF
  62. [NetDev]
  63. Name=br0
  64. Kind=bridge
  65. EOF
  66.  
  67. rpi ~# cat > /etc/systemd/network/04-br0_add-eth0.network <<EOF
  68. [Match]
  69. Name=eth0
  70. [Network]
  71. Bridge=br0
  72. EOF
  73.  
  74. rpi ~# cat > /etc/systemd/network/12-br0_up.network <<EOF
  75. [Match]
  76. Name=br0
  77. [Network]
  78. DHCP=yes
  79. EOF
  80.    
  81. rpi ~# systemctl edit wpa_supplicant@wlan0.service
  82.    
  83. [Service]
  84. ExecStartPre=/sbin/iw dev wlan0 set type __ap
  85. ExecStartPre=/bin/ip link set wlan0 master br0
  86.  
  87. ExecStart=
  88. ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl80211,wext -i%I -bbr0
  89.  
  90. ExecStopPost=/bin/ip link set wlan0 nomaster
  91. ExecStopPost=/sbin/iw dev wlan0 set type managed
  92.    
  93. rpi ~$ systemctl status systemd-networkd.service
  94. rpi ~$ systemctl status wpa_supplicant@wlan0.service
  95.    
  96. rpi ~$ journalctl --boot --pager-end
  97.    
  98. rpi ~$ journalctl --boot --follow
  99.    
  100. rpi ~$ systemctl cat wpa_supplicant@wlan0.service
  101.    
  102. rpi ~$ systemctl show wpa_supplicant@wlan0.service
  103.    
  104. rpi ~$ sudo systemctl edit wpa_supplicant@wlan0.service
  105. ExecStart=
  106. ExecStart=/sbin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dnl80211,wext -i%I -bbr0 -d
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top