Не получается настроить WireGuard. При попытке открыть ссылку curl zx2c4.com/ip пишет connection timed out.
Конфиги сервера:
/etc/systemd/system/wireguard.service
[Unit]
Description=WireGuard Server
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/ip link add dev wg0 type wireguard
ExecStart=/bin/ip address add 192.168.4.1/24 dev wg0
ExecStart=/usr/bin/wg setconf wg0 /etc/wireguard/server.conf
ExecStart=/bin/ip link set up dev wg0
ExecStart=/bin/ncat -k -l -p 41414 -v
ExecStop=/bin/ip link del dev wg0
[Install]
WantedBy=multi-user.target
/etc/wireguard/server.conf
[Interface]
PrivateKey = *******
ListenPort = 41414
[Peer]
PublicKey = *******
AllowedIPs = 192.168.4.5/32
Вывод команд на сервере:
localhost% ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:50:56:**:**:** brd ff:ff:ff:ff:ff:ff
inet 5.9.***.***/24 brd 5.9.***.*** scope global ens3
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:****:****/64 scope link
valid_lft forever preferred_lft forever
22: wg0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1423 qdisc noqueue state UNKNOWN group default qlen 1
link/none
inet 192.168.4.1/24 scope global wg0
valid_lft forever preferred_lft forever
inet6 fe80::e0c7:d8ad:****:****/64 scope link flags 800
valid_lft forever preferred_lft forever
localhost% ip route
default via 5.9.***.*** dev ens3
5.9.***.0/24 dev ens3 proto kernel scope link src 5.9.***.***
192.168.4.0/24 dev wg0 proto kernel scope link src 192.168.4.1
localhost% ss -au
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:41414 *:*
UNCONN 0 0 :::41414 :::*
localhost% wg
interface: wg0
public key: ******
private key: ******
listening port: 41414
peer: ******
endpoint: 176.213.***.***:21841
allowed ips: 192.168.4.5/24
latest handshake: 12 minutes, 6 seconds ago
bandwidth: 2.53 KiB received, 352 B sent
Конфиги клиента:
/etc/systemd/system/wireguard.service
[Unit]
Description=WireGuard Client
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/ip link add dev wg0 type wireguard
ExecStart=/bin/ip address add 192.168.4.5/24 dev wg0
ExecStart=/bin/wg setconf wg0 /etc/wireguard/client.conf
ExecStart=/bin/ip link set up dev wg0
ExecStart=/bin/ip route add 5.9.***.*** via 192.168.1.1
ExecStart=/bin/ip route add 0/1 dev wg0
ExecStart=/bin/ip route add 128/1 dev wg0
ExecStart=/bin/ncat -k -l -p 21841 -v
ExecStop=/bin/ip link del dev wg0
[Install]
WantedBy=multi-user.target
/etc/wireguard/client.conf
[Interface]
PrivateKey = ******
ListenPort = 21841
[Peer]
PublicKey = ******
AllowedIPs = 0.0.0.0/0
Endpoint = 5.9.***.***:41414
PersistentKeepalive = 25
Вывод команд на клиенте:
localhost% ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 50:7b:9d:**:**:** brd ff:ff:ff:ff:ff:ff
inet 192.168.1.62/24 brd 192.168.1.255 scope global dynamic enp2s0
valid_lft 68839sec preferred_lft 68839sec
inet6 fe80::348e:136d:****:****/64 scope link
valid_lft forever preferred_lft forever
3: wlp1s0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether c8:ff:28:**:**:** brd ff:ff:ff:ff:ff:ff
20: wg0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1423 qdisc noqueue state UNKNOWN group default qlen 1
link/none
inet 192.168.4.5/24 scope global wg0
valid_lft forever preferred_lft forever
inet6 fe80::8f32:65b6:****:****/64 scope link flags 800
valid_lft forever preferred_lft forever
localhost% ip route
0.0.0.0/1 dev wg0 scope link
default via 192.168.1.1 dev enp2s0 proto static metric 100
5.9.***.*** via 192.168.1.1 dev enp2s0
128.0.0.0/1 dev wg0 scope link
192.168.1.0/24 dev enp2s0 proto kernel scope link src 192.168.1.62 metric 100
192.168.4.0/24 dev wg0 proto kernel scope link src 192.168.4.5
localhost% ss -au
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:21841 *:*
UNCONN 0 0 :::21841 :::*
localhost% wg
interface: wg0
public key: ******
private key: ******
listening port: 21841
peer: ******
endpoint: 5.9.***.***:41414
allowed ips: 0.0.0.0/0
latest handshake: 40 seconds ago
bandwidth: 178 B received, 6.10 KiB sent
persistent keepalive: every 25 seconds
Я так понимаю, что сервер не принимает пакеты с клиента. Есть подозрение, что из-за неправильно указанного ip в конфиге server.conf, но какой нужно прописать правильно я не соображаю. Либо же проблема в чем-то еще...