При подключении из винды имею такой лог:
2022-07-09 17:12:54.254: [TUN] [openWRT] Handshake for peer 1 (192.168.0.1:51830) did not complete after 5 seconds, retrying (try 2)
2022-07-09 17:12:54.254: [TUN] [openWRT] Sending handshake initiation to peer 1 (192.168.0.1:51830)
Задача сделать тунель в локальной сети с Винды (192.168.0.241) на роутер 192.168.0.1 ( это для теста, потом конечно буду поднимать не из локалки.)
<
На роутере /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
config interface 'lan'
option type 'bridge'
option ifname 'eth0.1'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.0.1'
config interface 'wan'
option ifname 'eth0.2'
option proto 'dhcp'
option peerdns '0'
option force_link '1'
list dns '208.67.222.222'
list dns '208.67.220.220'
option delegate '0'
config device 'wan_eth0_2_dev'
option name 'eth0.2'
option macaddr 'мак'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '2 3 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '4 6t'
config interface 'WG' <b>// - это другой интерфейс, тут роутер выступает клиентом и всё работает</b>
option proto 'wireguard'
option private_key 'ключ'
list addresses '10.6.0.7/24'
option force_link '1'
option delegate '0'
config wireguard_WG <b>// - это другой интерфейс, тут роутер выступает клиентом и всё работает</b>
option public_key 'ключ'
option persistent_keepalive '25'
option endpoint_port 'порт'
option endpoint_host 'хост'
option preshared_key 'ключ'
list allowed_ips '0.0.0.0/0'
list allowed_ips '::/0'
config rule
option priority '100'
option lookup 'vpn'
option mark '0x1'
config interface 'wgsv' <b>// - это уже сервер, который даёт ошибку, тут роутер выступает клиентом и всё работает</b>
option proto 'wireguard'
option listen_port '51830'
option private_key 'приват сервера'
option delegate '0'
list addresses '10.10.10.1/32'
option mtu '1280'
config wireguard_wgsv
option description 'PC1'
option endpoint_port '51830'
option endpoint_host '192.168.0.1'
option route_allowed_ips '1'
option public_key 'паблик пира'
list allowed_ips '10.10.10.2/32'
option persistent_keepalive '25'
Настройка WG на винде
[Interface]
PrivateKey = приват сервера
ListenPort = 51830
Address = 10.10.10.2/32
DNS = 8.8.8.8
[Peer]
PublicKey = паблик сервера
AllowedIPs = 0.0.0.0/0
Endpoint = 192.168.0.1:51830
PersistentKeepalive = 25
На роутере /etc/config/firewall
config defaults
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option synflood_protect '1'
config zone 'lan'
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option network 'lan'
config zone 'wan'
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
option network 'wan'
config forwarding
option src 'lan'
option dest 'wan'
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option src_ip 'fc00::/6'
option dest_ip 'fc00::/6'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option dest 'lan'
option proto 'esp'
option target 'ACCEPT'
config rule
option name 'Allow-ISAKMP'
option src 'wan'
option dest 'lan'
option dest_port '500'
option proto 'udp'
option target 'ACCEPT'
config include
option path '/etc/firewall.user'
config nat
option target 'MASQUERADE'
option src 'wan'
option enabled '0'
config ipset
option name 'vpn_subnets'
option storage 'hash'
option loadfile '/tmp/lst/subnet.lst'
option match 'dst_net'
config ipset
option name 'vpn_ipsum'
option storage 'hash'
option loadfile '/tmp/lst/ipsum.lst'
option match 'dst_net'
config rule
option name 'mark_subnet'
option src 'lan'
option dest '*'
option proto 'all'
option ipset 'vpn_subnets'
option set_mark '0x1'
option target 'MARK'
config rule
option name 'mark_ipsum'
option src 'lan'
option dest '*'
option proto 'all'
option ipset 'vpn_ipsum'
option set_mark '0x1'
option target 'MARK'
config rule
option src 'wan'
option name 'IPSec ESP'
option proto 'esp'
option target 'ACCEPT'
config rule
option src 'wan'
option name 'IPSec IKE'
option proto 'udp'
option dest_port '500'
option target 'ACCEPT'
config rule
option src 'wan'
option name 'IPSec NAT-T'
option proto 'udp'
option dest_port '4500'
option target 'ACCEPT'
config rule
option src 'wan'
option name 'Auth Header'
option proto 'ah'
option target 'ACCEPT'
config rule
option src '*'
option target 'ACCEPT'
option proto 'udp'
option name 'Allow-Wireguard-Inbound'
option dest_port '51830'
config zone
option name 'vpn'
option input 'ACCEPT'
option forward 'ACCEPT'
option output 'ACCEPT'
option masq '1'
option network 'WG wgsv'
config forwarding
option dest 'lan'
option src 'vpn'
config forwarding
option dest 'wan'
option src 'vpn'
config forwarding
option dest 'vpn'
option src 'lan'
config forwarding
option dest 'vpn'
option src 'wan'