Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ubuntu@instance-20210915-wireguard:~$ ifconfig
- ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9000
- inet 10.0.0.183 netmask 255.255.255.0 broadcast 10.0.0.255
- inet6 fe80::17ff:fe00:3654 prefixlen 64 scopeid 0x20<link>
- ether 02:00:17:00:36:54 txqueuelen 1000 (Ethernet)
- RX packets 609918 bytes 359694326 (359.6 MB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 613586 bytes 744638315 (744.6 MB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
- inet 127.0.0.1 netmask 255.0.0.0
- inet6 ::1 prefixlen 128 scopeid 0x10<host>
- loop txqueuelen 1000 (Local Loopback)
- RX packets 52957 bytes 6451354 (6.4 MB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 52957 bytes 6451354 (6.4 MB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1420
- inet 10.6.0.1 netmask 255.255.255.0 destination 10.6.0.1
- unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
- RX packets 662 bytes 176468 (176.4 KB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 396 bytes 77836 (77.8 KB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- --------------------------------------------------------------------------------------------------------------------
- ubuntu@instance-20210915-wireguard:~$ sudo wg show
- interface: wg0
- public key: mCK/FAHGtXFBNLS5WpHhSPEBvZRwY09HohD1YkNCNSI=
- private key: (hidden)
- listening port: 51820
- peer: r56sl4HNKHFkz8/r+aGqOHClMuXUt9lGE34gpktP5Q4=
- preshared key: (hidden)
- endpoint: 167.189.155.111:56495
- allowed ips: 10.6.0.5/32, 172.16.0.10/32
- latest handshake: 1 minute, 13 seconds ago
- transfer: 162.95 KiB received, 72.80 KiB sent
- persistent keepalive: every 15 seconds
- peer: ZCAV6xDLswBuqYWs38JYwvx2fwvmR1uEFRIAD760pxI=
- preshared key: (hidden)
- endpoint: 167.189.149.52:57321
- allowed ips: 10.6.0.3/32
- latest handshake: 2 minutes, 52 seconds ago
- transfer: 10.49 KiB received, 4.45 KiB sent
- peer: WaP0UPdQWKE0uy3F750cOEeLmLkikdtw0XAw/eGcrFI=
- preshared key: (hidden)
- allowed ips: 10.6.0.0/24
- peer: 2lSWhk5B37yZheuhp7+e3zjySvql943SuQkuFNKteUw=
- preshared key: (hidden)
- allowed ips: 10.6.0.4/32
- --------------------------------------------------------------------------------------------------------------------
- ubuntu@instance-20210915-wireguard:~$ sudo systemctl status [email protected]
- ● [email protected] - WireGuard via wg-quick(8) for wg0
- Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
- Drop-In: /etc/systemd/system/[email protected]
- └─override.conf
- Active: active (exited) since Sat 2021-09-25 06:09:16 UTC; 56min ago
- Docs: man:wg-quick(8)
- man:wg(8)
- https://www.wireguard.com/
- https://www.wireguard.com/quickstart/
- https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
- https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
- Process: 34982 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=0/SUCCESS)
- Main PID: 34982 (code=exited, status=0/SUCCESS)
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] wg setconf wg0 /dev/fd/63
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34997]: Warning: AllowedIP has nonzero host part: 10.6.0.2/24
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] ip -4 address add 10.6.0.1/24 dev wg0
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] ip link set mtu 1420 up dev wg0
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] ip -4 route add 172.16.0.10/32 dev wg0
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] iptables -A FORWARD -i wg0 -j ACCEPT;
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] iptables -A FORWARD -o wg0 -j ACCEPT;
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
- Sep 25 06:09:16 instance-20210915-wireguard wg-quick[34982]: [#] sysctl -q -w net.ipv4.ip_forward=1
- Sep 25 06:09:16 instance-20210915-wireguard systemd[1]: Finished WireGuard via wg-quick(8) for wg0.
- --------------------------------------------------------------------------------------------------------------------
- ubuntu@instance-20210915-wireguard:~$ sudo iptables -L -n -x -v -t nat
- Chain PREROUTING (policy ACCEPT 88 packets, 6720 bytes)
- pkts bytes target prot opt in out source destination
- 1352 442236 DNAT all -- * * 0.0.0.0/0 172.16.0.0/24 to:10.6.0.1
- Chain INPUT (policy ACCEPT 39 packets, 2916 bytes)
- pkts bytes target prot opt in out source destination
- Chain OUTPUT (policy ACCEPT 311 packets, 26715 bytes)
- pkts bytes target prot opt in out source destination
- Chain POSTROUTING (policy ACCEPT 128 packets, 12036 bytes)
- pkts bytes target prot opt in out source destination
- 693 65582 MASQUERADE all -- * ens3 10.6.0.0/24 0.0.0.0/0 /* wireguard-nat-rule */
- 20 1680 MASQUERADE all -- * * 10.6.0.0/24 172.16.0.0/24
- 0 0 MASQUERADE all -- * eth1 0.0.0.0/0 0.0.0.0/0
- 183 14679 MASQUERADE all -- * ens3 0.0.0.0/0 0.0.0.0/0
- --------------------------------------------------------------------------------------------------------------------
- ubuntu@instance-20210915-wireguard:~$ route -n
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 0.0.0.0 10.0.0.1 0.0.0.0 UG 100 0 0 ens3
- 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 ens3
- 10.6.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
- 169.254.0.0 0.0.0.0 255.255.0.0 U 100 0 0 ens3
- 172.16.0.10 0.0.0.0 255.255.255.255 UH 0 0 0 wg0
Add Comment
Please, Sign In to add comment