1 (edytowany przez MarcinT 2021-09-25 17:48:42)

Temat: Wireguard - problem z połączeniem

Mam problem z uruchomieniem Wireguard na MIR3G Openwrt 21.02 OpenWrt 21.02-SNAPSHOT r16295-3a051a234a, po
instalacji Wireguarda zgodnie z poradnikiem: https://eko.one.pl/?p=openwrt-wireguard nie mogę się połączyć do serwera Wireguard, bład z klienta:
2021-09-25 18:21:46.451: [TUN] [dom] Handshake for peer 1 (<moje IP>:55055) did not complete after 5 seconds, retrying (try 2)

Ustawienia firewalla:

firewall.@defaults[0]=defaults
firewall.@defaults[0].input='ACCEPT'
firewall.@defaults[0].output='ACCEPT'
firewall.@defaults[0].forward='REJECT'
firewall.@defaults[0].synflood_protect='1'
firewall.@zone[0]=zone
firewall.@zone[0].name='lan'
firewall.@zone[0].input='ACCEPT'
firewall.@zone[0].output='ACCEPT'
firewall.@zone[0].forward='ACCEPT'
firewall.@zone[0].network='lan'
firewall.@zone[1]=zone
firewall.@zone[1].name='wan'
firewall.@zone[1].input='REJECT'
firewall.@zone[1].output='ACCEPT'
firewall.@zone[1].forward='REJECT'
firewall.@zone[1].masq='1'
firewall.@zone[1].mtu_fix='1'
firewall.@zone[1].network='wan'
firewall.@forwarding[0]=forwarding
firewall.@forwarding[0].src='lan'
firewall.@forwarding[0].dest='wan'
firewall.@rule[0]=rule
firewall.@rule[0].name='Allow-DHCP-Renew'
firewall.@rule[0].src='wan'
firewall.@rule[0].proto='udp'
firewall.@rule[0].dest_port='68'
firewall.@rule[0].target='ACCEPT'
firewall.@rule[0].family='ipv4'
firewall.@rule[1]=rule
firewall.@rule[1].name='Allow-Ping'
firewall.@rule[1].src='wan'
firewall.@rule[1].proto='icmp'
firewall.@rule[1].icmp_type='echo-request'
firewall.@rule[1].family='ipv4'
firewall.@rule[1].target='ACCEPT'
firewall.@rule[2]=rule
firewall.@rule[2].name='Allow-IGMP'
firewall.@rule[2].src='wan'
firewall.@rule[2].proto='igmp'
firewall.@rule[2].family='ipv4'
firewall.@rule[2].target='ACCEPT'
firewall.@rule[3]=rule
firewall.@rule[3].name='Allow-DHCPv6'
firewall.@rule[3].src='wan'
firewall.@rule[3].proto='udp'
firewall.@rule[3].src_ip='fc00::/6'
firewall.@rule[3].dest_ip='fc00::/6'
firewall.@rule[3].dest_port='546'
firewall.@rule[3].family='ipv6'
firewall.@rule[3].target='ACCEPT'
firewall.@rule[4]=rule
firewall.@rule[4].name='Allow-MLD'
firewall.@rule[4].src='wan'
firewall.@rule[4].proto='icmp'
firewall.@rule[4].src_ip='fe80::/10'
firewall.@rule[4].icmp_type='130/0' '131/0' '132/0' '143/0'
firewall.@rule[4].family='ipv6'
firewall.@rule[4].target='ACCEPT'
firewall.@rule[5]=rule
firewall.@rule[5].name='Allow-ICMPv6-Input'
firewall.@rule[5].src='wan'
firewall.@rule[5].proto='icmp'
firewall.@rule[5].icmp_type='echo-request' 'echo-reply' 'destination-unreachable' 'packet-too-big' 'time-exceeded' 'bad-header' 'unknown-header-type' 'router-solicitation' 'neighbour-solicitation' 'router-advertisement' 'neighbour-advertisement'
firewall.@rule[5].limit='1000/sec'
firewall.@rule[5].family='ipv6'
firewall.@rule[5].target='ACCEPT'
firewall.@rule[6]=rule
firewall.@rule[6].name='Allow-ICMPv6-Forward'
firewall.@rule[6].src='wan'
firewall.@rule[6].dest='*'
firewall.@rule[6].proto='icmp'
firewall.@rule[6].icmp_type='echo-request' 'echo-reply' 'destination-unreachable' 'packet-too-big' 'time-exceeded' 'bad-header' 'unknown-header-type'
firewall.@rule[6].limit='1000/sec'
firewall.@rule[6].family='ipv6'
firewall.@rule[6].target='ACCEPT'
firewall.@rule[7]=rule
firewall.@rule[7].name='Allow-IPSec-ESP'
firewall.@rule[7].src='wan'
firewall.@rule[7].dest='lan'
firewall.@rule[7].proto='esp'
firewall.@rule[7].target='ACCEPT'
firewall.@rule[8]=rule
firewall.@rule[8].name='Allow-ISAKMP'
firewall.@rule[8].src='wan'
firewall.@rule[8].dest='lan'
firewall.@rule[8].dest_port='500'
firewall.@rule[8].proto='udp'
firewall.@rule[8].target='ACCEPT'
firewall.@rule[9]=rule
firewall.@rule[9].name='Support-UDP-Traceroute'
firewall.@rule[9].src='wan'
firewall.@rule[9].dest_port='33434:33689'
firewall.@rule[9].proto='udp'
firewall.@rule[9].family='ipv4'
firewall.@rule[9].target='REJECT'
firewall.@rule[9].enabled='0'
firewall.@include[0]=include
firewall.@include[0].path='/etc/firewall.user'
firewall.@redirect[0]=redirect
firewall.@redirect[0].target='DNAT'
firewall.@redirect[0].name='ut'
firewall.@redirect[0].src='wan'
firewall.@redirect[0].src_dport='5525'
firewall.@redirect[0].dest='lan'
firewall.@redirect[0].dest_ip='192.168.1.10'
firewall.@redirect[0].dest_port='5525'
firewall.@redirect[1]=redirect
firewall.@redirect[1].target='DNAT'
firewall.@redirect[1].name='Q'
firewall.@redirect[1].src='wan'
firewall.@redirect[1].src_dport='32035'
firewall.@redirect[1].dest='lan'
firewall.@redirect[1].dest_ip='192.168.1.10'
firewall.@redirect[1].dest_port='32035'
firewall.@redirect[2]=redirect
firewall.@redirect[2].target='DNAT'
firewall.@redirect[2].name='T'
firewall.@redirect[2].src='wan'
firewall.@redirect[2].src_dport='25049'
firewall.@redirect[2].dest='lan'
firewall.@redirect[2].dest_ip='192.168.1.10'
firewall.@redirect[2].dest_port='25049'
firewall.@redirect[3]=redirect
firewall.@redirect[3].target='DNAT'
firewall.@redirect[3].name='S'
firewall.@redirect[3].src='wan'
firewall.@redirect[3].src_dport='49874-49875'
firewall.@redirect[3].dest='lan'
firewall.@redirect[3].dest_ip='192.168.1.10'
firewall.@redirect[3].dest_port='49874-49875'
firewall.miniupnpd=include
firewall.miniupnpd.type='script'
firewall.miniupnpd.path='/usr/share/miniupnpd/firewall.include'
firewall.miniupnpd.family='any'
firewall.miniupnpd.reload='1'
firewall.@rule[10]=rule
firewall.@rule[10].src='wan'
firewall.@rule[10].target='ACCEPT'
firewall.@rule[10].proto='udp'
firewall.@rule[10].dest_port='55055'
firewall.@rule[10].name='wireguard'
firewall.@zone[2]=zone
firewall.@zone[2].name='wg'
firewall.@zone[2].input='ACCEPT'
firewall.@zone[2].forward='ACCEPT'
firewall.@zone[2].output='ACCEPT'
firewall.@zone[2].masq='1'
firewall.@zone[2].network='wg0'
firewall.@forwarding[1]=forwarding
firewall.@forwarding[1].src='wg'
firewall.@forwarding[1].dest='wan'
firewall.@forwarding[2]=forwarding
firewall.@forwarding[2].src='wan'
firewall.@forwarding[2].dest='wg'
firewall.@forwarding[3]=forwarding
firewall.@forwarding[3].src='wg'
firewall.@forwarding[3].dest='lan'
firewall.@forwarding[4]=forwarding
firewall.@forwarding[4].src='lan'
firewall.@forwarding[4].dest='wg'

Ustawienia sieci:

network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.packet_steering='1'
network.globals.ula_prefix='fd4a:253f:2c70::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='lan1' 'lan2'
network.lan=interface
network.lan.device='br-lan'
network.lan.proto='static'
network.lan.ipaddr='192.168.1.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.wan=interface
network.wan.device='wan'
network.wan.proto='pppoe'
network.wan.username='xxx'
network.wan.password='xxx'
network.wan.ipv6='auto'
network.wg0=interface
network.wg0.proto='wireguard'
network.wg0.private_key='<klucz prywatny serwer>'
network.wg0.listen_port='55055'
network.wg0.addresses='10.8.0.1/24'
network.@wireguard_wg0[0]=wireguard_wg0
network.@wireguard_wg0[0].description='laptop'
network.@wireguard_wg0[0].public_key='<klucz publiczny z klienta>'
network.@wireguard_wg0[0].allowed_ips='10.8.0.2'
network.@wireguard_wg0[0].route_allowed_ips='1'
network.@wireguard_wg0[0].persistent_keepalive='25'

Wynik z wg:

interface: wg0
  public key: <klucz>
  private key: (hidden)
  listening port: 55055

Ustawienia klienta:

[Interface]
PrivateKey = <klucz prywatny klient>
Address = 10.8.0.2/32

[Peer]
PublicKey = <publiczny klucz serwera>
AllowedIPs = 0.0.0.0/0
Endpoint = <moje IP>:55055

Według nmapa od strony WANu port jest open|filtered:

root@XXX:~# nmap -p 55055 -sU <ip>
Starting Nmap 7.80 ( https://nmap.org ) at 2021-09-25 18:00 CEST
Nmap scan report for <ip>
Host is up (0.011s latency).

PORT      STATE         SERVICE
55055/udp open|filtered unknown

Proszę o pomoc. Dziękuje.

2

Odp: Wireguard - problem z połączeniem

Serwer nie odpowiada. Na czym postawiłeś "serwer" wireguarda?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: Wireguard - problem z połączeniem

Chce uruchomić serwer Wireguard na tym routerze

4

Odp: Wireguard - problem z połączeniem

Masz publiczne ip na wanie?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5 (edytowany przez MarcinT 2021-09-25 18:09:29)

Odp: Wireguard - problem z połączeniem

Tak, mam, wcześniej mi działał na nim serwer OpenVPN.

Pomogło zrestartowanie interfejsu po dodaniu klucza klienta - ifdown wg0 && ifup wg0 big_smile