Автор: funk2256, 1 год назад, написана на языке Plain Text.
Встраивание на сайт
  1. ❯ sudo wg-quick up wg0
  2. [#] ip link add wg0 type wireguard
  3. [#] wg setconf wg0 /dev/fd/63
  4. [#] ip -4 address add 10.13.13.1/32 dev wg0
  5. [#] ip link set mtu 1420 up dev wg0
  6. [#] resolvconf -a wg0 -m 0 -x
  7. [#] wg set wg0 fwmark 51820
  8. [#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820
  9. [#] ip -4 rule add not fwmark 51820 table 51820
  10. [#] ip -4 rule add table main suppress_prefixlength 0
  11. [#] sysctl -q net.ipv4.conf.all.src_valid_mark=1
  12. [#] iptables-restore -n
  13. iptables-restore v1.8.8 (legacy): iptables-restore: unable to initialize table 'raw'
  14.  
  15. Error occurred at line: 1
  16. Try `iptables-restore -h' or 'iptables-restore --help' for more information.
  17. [#] resolvconf -d wg0 -f
  18. [#] ip -4 rule delete table 51820
  19. [#] ip -4 rule delete table main suppress_prefixlength 0
  20. [#] ip link delete dev wg0
  21.  
  22. Конфиг Wireguard
  23. ❯ sudo cat /etc/wireguard/wg0.conf
  24. [Interface]
  25. Address = 10.13.13.1/32
  26. DNS = 10.13.13.1
  27. ListenPort = 51820
  28. PrivateKey =
  29.  
  30. [Peer]
  31. AllowedIPs = 0.0.0.0/0
  32. Endpoint = 109.107.173.206:51820
  33. PreSharedKey =
  34. PublicKey =
  35.  
  36. Поменял AllowedIPs на 0.0.0.0/1 что вроде как решает проблему
  37. https://github.com/linuxserver/docker-wireguard/issues/42
  38.  
  39. ❯ sudo wg-quick up wg0
  40. [#] ip link add wg0 type wireguard
  41. [#] wg setconf wg0 /dev/fd/63
  42. [#] ip -4 address add 10.13.13.1/32 dev wg0
  43. [#] ip link set mtu 1420 up dev wg0
  44. [#] resolvconf -a wg0 -m 0 -x
  45. [#] ip -4 route add 0.0.0.0/1 dev wg0
  46.  
  47.  
  48. Подключение вижу, но трафик не идет почти.
  49.  
  50. ❯ sudo wg show wg0
  51. interface: wg0
  52.   public key:
  53.   private key: (hidden)
  54.   listening port: 51820
  55.  
  56. peer:
  57.   preshared key: (hidden)
  58.   endpoint: 109.107.173.206:51820
  59.   allowed ips: 0.0.0.0/1
  60.   transfer: 0 B received, 1.45 KiB sent
  61.  
  62. ❯ sudo iptables -L
  63. Chain INPUT (policy ACCEPT)
  64. target     prot opt source               destination        
  65. ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:51820
  66. ACCEPT     udp  --  anywhere             anywhere             udp dpt:51820
  67.  
  68. Chain FORWARD (policy ACCEPT)
  69. target     prot opt source               destination        
  70. ACCEPT     all  --  anywhere             anywhere            
  71. ACCEPT     all  --  anywhere             anywhere            
  72.  
  73. Chain OUTPUT (policy ACCEPT)
  74. target     prot opt source               destination
  75.