smirnov

Wg assign peer public IP

Jan 22nd, 2021 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. # Server side
  2.  
  3. $ sysctl -w net.ipv4.conf.eth0.proxy_arp=1 && sysctl -w net.ipv4.ip_forward=1 && ip addr del SECOND_IP/NETMASK dev eth0
  4.  
  5. $ cat /etc/wireguard/server.conf
  6.  
  7. [Interface]
  8. Address = 10.0.0.1/32
  9. PrivateKey = SERVER_PRIVATEKEY
  10. ListenPort = 51820
  11.  
  12. [Peer]
  13. PublicKey = PEER0_PUBLICKEY
  14. PresharedKey = PEER0_PSK
  15. AllowedIPs = SECOND_IP/32
  16.  
  17.  
  18. # "Client" side
  19.  
  20. $ cat /etc/wireguard/peer0.conf
  21.  
  22. [Interface]
  23. Address = SECOND_IP/32
  24. PrivateKey = PEER0_PRIVATEKEY
  25. DNS = 1.1.1.1
  26.  
  27. [Peer]
  28. PublicKey = SERVER_PUBLICKEY
  29. PresharedKey = PEER0_PSK
  30. AllowedIPs = 0.0.0.0/0
  31. Endpoint = MAIN_IP:51820
  32. PersistentKeepalive = 25
Add Comment
Please, Sign In to add comment