In an LXC container I have Wireguard installed and the client connects normally and I see the port and the information, but when I try to curl to localhost (127.0.0.1) or to the local ip (192.168.1.180) it doesn't connect.
192.168.1.180 (Host IP) 10.7.0.2 (IP)
10.7.0.2:6060 <-> 192.168.1.180:6060
curl -I 10.7.0.2:6060
-Resolve OK --
curl -I 127.0.1:6060 (OR) curl -I 192.168.1.180:6060
Responde unreachable
My IPtables rules:
iptables -A FORWARD -i eth0 -j ACCEPT;
iptables -t nat -A PREROUTING -p tcp --dport 6060:6060 -j DNAT --to-destination 10.7.0.2;
iptables -w -t nat -A POSTROUTING -o eth0 -j MASQUERADE;
IPv4 Forward is active:
#sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
Server Wireguard Config:
root@wiretest:/etc/wireguard# cat wg0.conf
# Do not alter the commented lines
# They are used by wireguard-install
# ENDPOINT asd.demo.net
[Interface]
Address = 10.7.0.1/24
PrivateKey = CI0heA/1InAo........
ListenPort = 51820
# BEGIN_PEER nodotest
[Peer]
PublicKey = y1t+k9cR06F7/y6ANJtEx.......
PresharedKey = +Tya8VsxbB3i9hkIRf......
AllowedIPs = 10.7.0.2/32
# END_PEER nodotest
root@wiretest:/etc/wireguard#
Client Config:
root@wiredocker:/etc/wireguard# cat wg0.conf
[Interface]
Address = 10.0.0.2/24
DNS = 8.8.8.8
PrivateKey = +GLTuJnydedy2QMvTj5SGdr......
[Peer]
PublicKey = qlNPgT7Fwbjmexq09EVF........
PresharedKey = +Tya8VsxbB3i9hkIR......
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = asd.demo.net:51820
PersistentKeepalive = 25
root@wiredocker:/etc/wireguard#
Server IPTables List:
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:51823
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- 10.7.0.0/24 anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Thanks !