debian-network-setup.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. read -rp "type wifi name (ssid): " wifi_name
  4. read -rp "type wifi password (psk): " wifi_password
  5. read -rp "type interface name to listen (try: ip a): " interface_name
  6. echo "ctrl_interface=/run/wpa_supplicant
  7. update_config=1
  8. network={
  9. ssid=${wifi_name}
  10. psk=${wifi_password}
  11. }" > /etc/wpa_supplicant/wpa_supplicant.conf
  12. echo "allow-hotplug ${interface_name}
  13. iface ${interface_name} inet dhcp
  14. wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf" > /etc/network/interfaces
  15. wpa_supplicant -B -i "${interface_name}" -c /etc/wpa_supplicant/wpa_supplicant.conf
  16. systemctl enable wpa_supplicant.service
  17. systemctl restart wpa_supplicant.service
  18. # >>86119175
  19. # nano /etc/wpa_supplicant/wpa_supplicant.conf
  20. # ctrl_interface=/run/wpa_supplicant
  21. # update_config=1
  22. # network={
  23. # ssid="your_wifi_name"
  24. # psk="your_wifi_password"
  25. # }
  26. # nano /etc/network/interfaces
  27. # allow-hotplug wlp3s0
  28. # iface wlp3s0 inet dhcp
  29. # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  30. # wpa_supplicant -B -i wlp3s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
  31. # dhclient wlp3s0
  32. # >>86119436
  33. # or
  34. # systemctl enable wpa_supplicant.service
  35. # systemctl enable dhcpcd.service
  36. # systemctl restart wpa_supplicant.service
  37. # systemctl restart dhcpcd.service
  38. # at the end, I keep forgetting.
  39. # >>86459594 (You)
  40. # >/etc/network/interfaces
  41. # Are you really using sysV init?
  42. # >sourcing /etc/network/interfaces
  43. # This can't be right.
  44. # >ipv6 not works
  45. # Are you sure you have IPv6 connectivity to begin with or are you just missing the link-local?
  46. # Anyway, to enable a disabled IPv6:
  47. # sysctl net.ipv6.conf.wlx08beac1a726c.disable_ipv6=0
  48. # sysctl net.ipv6.conf.wlx08beac1a726c.autoconf=1
  49. # sysctl net.ipv6.conf.wlx08beac1a726c.accept_ra=1