Advertisement
finders2014

aws_Wg

Dec 7th, 2024
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. ubuntu@ip-xxxx:~$ sudo cat /etc/wireguard/wg0.conf
  2. [Interface]
  3. Address = 10.18.6.1/24
  4. MTU = 1380
  5.  
  6. PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -i %i -j ACCEPT; ip6tables -A FORWARD -o %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens5 -j MASQUERADE;iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu; wg set %i private-key /etc/wireguard/%i.key
  7. PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens5 -j MASQUERADE; ip6tables -D FORWARD -i %i -j ACCEPT ; ip6tables -D FORWARD -o %i -j ACCEPT
  8. ListenPort = 51820
  9. #lenovo
  10. [Peer]
  11. PublicKey = laptop pub key
  12. AllowedIPs = 10.18.6.3/32
  13. PresharedKey = Pre-Shared Key
  14.  
  15. #Raspberry PI
  16. [Peer]
  17. PublicKey = Pi - pub key
  18. AllowedIPs = 10.18.6.5/32
  19. PresharedKey = Pre-Shared Key
  20.  
  21.  
  22. #Desktop
  23. [Peer]
  24. PublicKey = ubuntu desktop pub key
  25. AllowedIPs = 10.18.6.2/32
  26. PresharedKey = Pre-Shared Key
  27.  
  28. ubuntu@ip-xxxx:~$ sudo wg show
  29. interface: wg0
  30. public key: aws-pub-key
  31. private key: (hidden)
  32. listening port: 51820
  33.  
  34. peer: Ras Pi Pub key
  35. preshared key: (hidden)
  36. endpoint: xxxxxxx
  37. allowed ips: 10.18.6.5/32
  38. latest handshake: 1 minute, 28 seconds ago
  39. transfer: 3.97 KiB received, 4.17 KiB sent
  40.  
  41. peer: Ubuntu Desktop Pub key
  42. preshared key: (hidden)
  43. endpoint: xxxxxx
  44. allowed ips: 10.18.6.2/32
  45. latest handshake: 1 minute, 48 seconds ago
  46. transfer: 308 B received, 92 B sent
  47.  
  48. peer: laptop pub key
  49. preshared key: (hidden)
  50. allowed ips: 10.18.6.3/32
  51.  
  52. ubuntu@ip-xxxx:~$ route
  53. Kernel IP routing table
  54. Destination Gateway Genmask Flags Metric Ref Use Iface
  55. default ip-172-31-16-1. 0.0.0.0 UG 100 0 0 ens5
  56. 10.18.6.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
  57. ip-172-31-0-2.a ip-172-31-16-1. 255.255.255.255 UGH 100 0 0 ens5
  58. 172.31.16.0 0.0.0.0 255.255.240.0 U 100 0 0 ens5
  59. ip-172-31-16-1. 0.0.0.0 255.255.255.255 UH 100 0 0 ens5
  60.  
  61. ubuntu@ip-xxxx:~$ ip addr
  62. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  63. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  64. inet 127.0.0.1/8 scope host lo
  65. valid_lft forever preferred_lft forever
  66. inet6 ::1/128 scope host noprefixroute
  67. valid_lft forever preferred_lft forever
  68. 2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
  69. link/ether 06:54:1c:2a:3b:7b brd ff:ff:ff:ff:ff:ff
  70. inet 172.31.23.120/20 metric 100 brd 172.31.31.255 scope global dynamic ens5
  71. valid_lft 2790sec preferred_lft 2790sec
  72. inet6 fe80::454:1cff:fe2a:3b7b/64 scope link
  73. valid_lft forever preferred_lft forever
  74. 4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1380 qdisc noqueue state UNKNOWN group default qlen 1000
  75. link/none
  76. inet 10.18.6.1/24 scope global wg0
  77. valid_lft forever preferred_lft forever
  78.  
  79. ubuntu@ip-xxxx:~$ sudo resolvectl status
  80. Global
  81. Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  82. resolv.conf mode: stub
  83.  
  84. Link 2 (ens5)
  85. Current Scopes: DNS
  86. Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  87. Current DNS Server: 172.31.0.2
  88. DNS Servers: 172.31.0.2
  89. DNS Domain: ap-south-1.compute.internal
  90.  
  91. Link 4 (wg0)
  92. Current Scopes: none
  93. Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement