S
S
Sergey Vasiliev2021-10-04 17:55:42
VPN
Sergey Vasiliev, 2021-10-04 17:55:42

What to do if WireGuard servers don't ping?

Hello, I set up a WireGuard connection between 2 linux servers, everything went well, the network was added without errors, but for some reason the servers do not want to ping each other.
Here is the server configuration:

[Interface]
Address = 10.2.0.1/24
PrivateKey = kA7W8ujEoicjnxp0WS6pvzZX3crPP9+j9KmATJfy7Vc=
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 39548
[Peer]
PublicKey = jxnB4ZWqXdV4xRDv8jnGQfETYN9PZynf3CX6OigayUQ=
AllowedIPs = 10.2.0.2/32


Here is the client:

[Interface]
PrivateKey = cFNg67vpQEOilpIR2XiZwfQGBNBkYL9cBLq7beu+tGY=
Address = 10.2.0.2/32
DNS = 8.8.8.8

[Peer]
PublicKey = B4HdfnsJNG4arhaeJuE5UZvxJiFVWHo7Rh3LDM9fJFQ=
Endpoint = server_ip:39548
PersistentKeepalive = 5


When checking the status, the wg command outputs this:

interface: wg0-server
  public key: B4HdfnsJNG4arhaeJuE5UZvxJiFVWHo7Rh3LDM9fJFQ=
  private key: (hidden)
  listening port: 39548

peer: jxnB4ZWqXdV4xRDv8jnGQfETYN9PZynf3CX6OigayUQ=
  endpoint: client_ip:59473
  allowed ips: 10.2.0.2/32
  latest handshake: 40 seconds ago
  transfer: 3.22 KiB received, 2.09 KiB sent


Also, through ifconfig, you can see that some packets go over the network back and forth:
wg0-server: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1420
        inet 10.2.0.1  netmask 255.255.255.0  destination 10.2.0.1
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 87  bytes 3712 (3.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 19  bytes 2144 (2.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


But ping and trace do not give any result for some reason.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2021-10-04
@yellowmew

some packets go around the network back and forth

there are all sorts of things here ..
Wireguard, for a second, this is UDP, and pings are ICMP. The protocols are different
Open icmp or check the availability in another way, for example, the availability of the UDP port using nc
nc -zvu <SERVER> <PORT>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question