OPNsense Forum

English Forums => Virtual private networks => Topic started by: dsh on November 14, 2021, 08:47:00 AM

Title: Wireguard: Peer's port mismatches and never do handshake
Post by: dsh on November 14, 2021, 08:47:00 AM
Hi there.

I am trying to connect my linux device to my opnserver. Unfortunately my linux device's port never matches and thus never do handshake.

OPNsense config

(https://i.postimg.cc/qv43BLLL/Screenshot-from-2021-11-14-15-31-22.png)

Endpoint config
(https://i.postimg.cc/QMMK1dvK/Screenshot-from-2021-11-14-15-34-22.png)

Linux device wg0.conf

(https://i.postimg.cc/9fNRpjj8/Screenshot-from-2021-11-14-15-35-51.png)

First I have tried without ListenPort, thus it was running at random port on linux device.

When I see OPN senses config, I see below.

(https://i.postimg.cc/rwjtDrZL/Screenshot-from-2021-11-14-15-34-59.png)

For example in this case it's trying to connect back port 44000.

If I intentionally change to 44000 in Linux device with ListenPort declaration, OPNsense's endpoint's port will change to random port.

What could be the issue. I have allowed 52820 on firewall. Thanks in advance.

Title: Re: Wireguard: Peer's port mismatches and never do handshake
Post by: Patrick M. Hausen on November 14, 2021, 09:53:20 AM
What does your outbound NAT rule look like? If you manually created tge NAT rules snd NAT "everything" instead if e.g. "LAN net", that can happen.
Title: Re: Wireguard: Peer's port mismatches and never do handshake
Post by: dsh on November 14, 2021, 10:00:15 AM
My NAT outbound is by default.

(https://i.postimg.cc/c4QYfH4X/Screenshot-from-2021-11-14-16-59-11.png)
Title: Re: Wireguard: Peer's port mismatches and never do handshake
Post by: dsh on November 14, 2021, 10:13:52 AM
Not sure what they means hopefully useful for you.

(https://i.postimg.cc/tg5G6FLp/Screenshot-from-2021-11-14-17-08-16.png)


44027 is the port showing in list configuration

(https://i.postimg.cc/h4xWbWF2/Screenshot-from-2021-11-14-17-13-09.png)
Title: Re: Wireguard: Peer's port mismatches and never do handshake
Post by: chemlud on November 14, 2021, 11:19:24 AM
You have a public IP in Mongolia? Would not post it here...

Looks like the tunnel is up, according to the last screenshot. Maybe some FW rules missing on WG interface to make traffic flow?
Title: Re: Wireguard: Peer's port mismatches and never do handshake
Post by: Patrick M. Hausen on November 14, 2021, 11:19:58 AM
OK, so it's the other end that is misbehaving. You need to check the NAT and/or the WireGuard configuration there.