[Solved] Can't connect to host after enabling WireGuard tunnel
I installed WireGuard on my host and set this configuration /etc/wireguard/wg0.conf
:
<span style="color:#323232;">[Interface]
</span><span style="color:#323232;">Address = 10.0.0.1/24
</span><span style="color:#323232;">ListenPort = 51820
</span><span style="color:#323232;">PrivateKey = [REDACTED]
</span><span style="color:#323232;">PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
</span><span style="color:#323232;">PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.2/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.3/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.4/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.5/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.6/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.7/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.8/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.9/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.10/32
</span><span style="color:#323232;">
</span><span style="color:#323232;">[Peer]
</span><span style="color:#323232;">PublicKey = [REDACTED]
</span><span style="color:#323232;">PresharedKey = [REDACTED]
</span><span style="color:#323232;">AllowedIPs = 10.0.0.11/32
</span><span style="color:#323232;">
</span>
Nmap scan when wg0 is down:
<span style="color:#323232;">Starting Nmap 7.93 ( https://nmap.org ) at 2024-08-16 03:26 CDT
</span><span style="color:#323232;">Host is up (0.050s latency).
</span><span style="color:#323232;">Not shown: 998 closed tcp ports (conn-refused)
</span><span style="color:#323232;">PORT STATE SERVICE
</span><span style="color:#323232;">22/tcp open ssh
</span><span style="color:#323232;">179/tcp filtered bgp
</span><span style="color:#323232;">
</span><span style="color:#323232;">Nmap done: 1 IP address (1 host up) scanned in 1.93 seconds
</span>
Nmap scan when wg0 is up:
<span style="color:#323232;">Starting Nmap 7.93 ( https://nmap.org ) at 2024-08-16 03:27 CDT
</span><span style="color:#323232;">All 1000 scanned ports are in ignored states.
</span><span style="color:#323232;">Not shown: 1000 filtered tcp ports (no-response)
</span><span style="color:#323232;">
</span><span style="color:#323232;">Nmap done: 1 IP address (1 host up) scanned in 201.43 seconds
</span><span style="color:#323232;">
</span>
I also cannot connect to host via ssh. How to fix this issue?
Upd. Fixed my changing server WireGuard IP to 10.0.1.1. 10.0.0.1 was already taken