Temat: Dostęp z VPNa do LANu

Cześć, mam problem z którym nie mogę sobie poradzić.
Mam router LINKSYS_MR8300, na którym jest server VPN (wireguard).
Router 192.168.0.1
Wireguard: 10.8.0.1

Chciałbym klientami mieć dostęp do całej sieci lokalnej. Obecnie klient01 pinguje tylko adres 192.168.0.1.
Czy mam coś źle skonfigurowane ?
Bardzo bym prosił o pomoc

logi configów

root@LINKSYS_MR8300:~# cat /etc/config/network
config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdb0:e37c:52ac::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.0.1'

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '1 2 3 4 0'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 0'

config interface 'wg_server'
        option proto 'wireguard'
        option private_key 'cO...'
        option listen_port '51820'
        list addresses '10.8.0.1/32'

config wireguard_wg_server
        option public_key 'Xa...'
        option description 'klient01'
        list allowed_ips '10.8.0.0/24'
        option route_allowed_ips '1'

config wireguard_wg_server
        option description 'klient02'
        option public_key 'C6...'
        list allowed_ips '10.8.0.0/24'
        option route_allowed_ips '1'

config wireguard_wg_server
        option description 'admin'
        option public_key 'MT...'
        option route_allowed_ips '1'
        list allowed_ips '10.8.0.0/24'
root@LINKSYS_MR8300:~# cat /etc/config/firewall

config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        list network 'lan'

config zone
        option name 'wan'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list 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 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 rule
        option name 'WG'
        option src 'vpn'
        option dest 'lan'
        option target 'ACCEPT'
        list dest_ip '192.168.0.0/24'

config zone
        option name 'vpn'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        list network 'wg_server'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'WG'
        list proto 'udp'
        option src 'wan'
        option src_dport '51820'
        option dest_ip '10.8.0.1/32'
        option dest_port '51820'

config forwarding
        option src 'lan'
        option dest 'vpn'

config forwarding
        option src 'vpn'
        option dest 'wan'

2

Odp: Dostęp z VPNa do LANu

A klient masz określony adres ip czy wszystko idzie przez router?

W allowedips w serwerze nie masz wskazanej klasy adresowej za lanem. Zobacz np. https://iliasa.eu/wireguard-how-to-acce … l-network/

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

3 (edytowany przez armen10 2022-11-03 18:31:37)

Odp: Dostęp z VPNa do LANu

Łącze się z Win10. Mój klient wygląda tak:

[Interface]
PrivateKey = gE...=
ListenPort = 51820
Address = 10.8.0.4/32
DNS = 1.1.1.1

[Peer]
PublicKey = kO...8=
AllowedIPs = 10.8.0.1/24, 192.168.0.0/24
Endpoint = 40.20.100.100:51820
PersistentKeepalive = 25

4

Odp: Dostęp z VPNa do LANu

No to masz prawie jak w linku który podałem. Dodaj allowedips do serwera także.

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

5 (edytowany przez armen10 2022-11-03 18:56:22)

Odp: Dostęp z VPNa do LANu

Cezary napisał/a:

W allowedips w serwerze nie masz wskazanej klasy adresowej za lanem.

Cezary dziękuję Ci za wskazówkę, ale czy mógłbyś mi to bardziej wyjaśnić co gdzie wpisać, bo nie kumam za bardzo ? sad
Coś takiego ?

config interface 'wg_server'
        option proto 'wireguard'
        option private_key 'cO...='
        option listen_port '51820'
        list addresses '10.8.0.1/32'
        list allowed_ips '192.168.0.0/24'

https://i.ibb.co/M1GVw4M/11.png

Jeśli to co powyżej jest ok, to ping dalej nie działa. Firewall na Windowsie wyłączony.

C:\Windows\System32>ping 192.168.0.192

Pinging 192.168.0.192 with 32 bytes of data:
Reply from 10.8.0.1: Destination port unreachable.
Reply from 10.8.0.1: Destination port unreachable.
Reply from 10.8.0.1: Destination port unreachable.

6

Odp: Dostęp z VPNa do LANu

Zakręciłem się. Dodaj option masq 1 w sekcji gdzie masz name=vpn. Zrestartuj i zobacz.
Ten redirect też jest zbędny.

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

7 (edytowany przez armen10 2022-11-03 19:15:45)

Odp: Dostęp z VPNa do LANu

No to klops...
Jutro wizyta u klienta, bo teraz nie mogę się połączyć. Dodałem option masq '1' i usunąłem sekcje redirect.
No cóż nie zawrze idzie po dobrej myśli.
Dziękuję Ci Cezary i tak...

8

Odp: Dostęp z VPNa do LANu

Powienienieś mieć otworzenie portu (rule) a nie redirect. Miałeś?

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

9

Odp: Dostęp z VPNa do LANu

Cezary napisał/a:

Powienienieś mieć otworzenie portu (rule) a nie redirect. Miałeś?

Nie.
Wszystko robiłem w zakładce Port Forwards. A jaka jest różnica między Port Forwards a Traffic Rules ?
Bo w sumie i tu i tu działa...

10

Odp: Dostęp z VPNa do LANu

rule do otwarcia portu. Redirect do przekierowania. W szczególności możesz przekierować port na sam router, ale to tak jak jeździć czołgiem po bułki do żabki.

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

11

Odp: Dostęp z VPNa do LANu

Na innym routerze mam coś takiego, czy jest to ok [zakładka Traffic Rules] ?
Działać działa, ale czy jest wg sztuki...
https://i.ibb.co/jDxDj33/11.png

12

Odp: Dostęp z VPNa do LANu

uci show firewall

pokaż. Screen z luci zostaw do pochwalenia się innym jakie to ładnie i kolorowe.

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

13 (edytowany przez armen10 2022-11-03 19:52:44)

Odp: Dostęp z VPNa do LANu

Hehe
W niektórych przypadkach lepiej mi chodzi, jak ustawię redirect niż rules...

root@OpenWrtCBK:~# uci show firewall
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' 'lte'
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].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.@redirect[0]=redirect
firewall.@redirect[0].target='DNAT'
firewall.@redirect[0].name='wol'
firewall.@redirect[0].proto='udp'
firewall.@redirect[0].src='wan'
firewall.@redirect[0].dest='lan'
firewall.@redirect[0].src_dport='9'
firewall.@redirect[0].dest_port='9'
firewall.@redirect[0].src_port='9'
firewall.@redirect[0].dest_ip='192.168.10.11'
firewall.@redirect[1]=redirect
firewall.@redirect[1].target='DNAT'
firewall.@redirect[1].proto='tcp'
firewall.@redirect[1].src='wan'
firewall.@redirect[1].src_dport='443'
firewall.@redirect[1].dest='lan'
firewall.@redirect[1].dest_ip='192.168.10.12'
firewall.@redirect[1].dest_port='443'
firewall.@redirect[1].name='Cloud443'
firewall.@redirect[2]=redirect
firewall.@redirect[2].target='DNAT'
firewall.@redirect[2].name='Cloud80'
firewall.@redirect[2].proto='tcp'
firewall.@redirect[2].src='wan'
firewall.@redirect[2].src_dport='80'
firewall.@redirect[2].dest='lan'
firewall.@redirect[2].dest_ip='192.168.10.12'
firewall.@redirect[2].dest_port='80'
firewall.@redirect[3]=redirect
firewall.@redirect[3].target='DNAT'
firewall.@redirect[3].name='RDP'
firewall.@redirect[3].proto='tcp'
firewall.@redirect[3].src='wan'
firewall.@redirect[3].src_dport='1986'
firewall.@redirect[3].dest='lan'
firewall.@redirect[3].dest_ip='192.168.10.11'
firewall.@redirect[3].dest_port='1986'
firewall.@redirect[4]=redirect
firewall.@redirect[4].target='DNAT'
firewall.@redirect[4].proto='tcp'
firewall.@redirect[4].src='wan'
firewall.@redirect[4].src_dport='5118'
firewall.@redirect[4].dest='lan'
firewall.@redirect[4].dest_ip='192.168.10.12'
firewall.@redirect[4].dest_port='5118'
firewall.@redirect[4].name='SSH_Cloud'
firewall.@redirect[5]=redirect
firewall.@redirect[5].target='DNAT'
firewall.@redirect[5].proto='udp'
firewall.@redirect[5].src='wan'
firewall.@redirect[5].src_dport='51825'
firewall.@redirect[5].dest_port='51825'
firewall.@redirect[5].name='WG'
firewall.@redirect[5].dest_ip='10.10.11.1/32'
firewall.@redirect[5].dest='vpn'
firewall.@redirect[5].enabled='0'
firewall.@zone[2]=zone
firewall.@zone[2].name='vpn'
firewall.@zone[2].masq='1'
firewall.@zone[2].input='ACCEPT'
firewall.@zone[2].output='ACCEPT'
firewall.@zone[2].forward='REJECT'
firewall.@zone[2].network='wg_server'
firewall.@forwarding[1]=forwarding
firewall.@forwarding[1].src='lan'
firewall.@forwarding[1].dest='vpn'
firewall.@forwarding[2]=forwarding
firewall.@forwarding[2].src='vpn'
firewall.@forwarding[2].dest='wan'
firewall.@rule[9]=rule
firewall.@rule[9].name='wg'
firewall.@rule[9].target='ACCEPT'
firewall.@rule[9].proto='udp'
firewall.@rule[9].src_port='51825'
firewall.@rule[9].dest_port='51825'
firewall.@rule[9].src='wan'
firewall.@rule[9].dest='vpn'
firewall.@rule[10]=rule
firewall.@rule[10].name='wg'
firewall.@rule[10].target='ACCEPT'
firewall.@rule[10].proto='all'
firewall.@rule[10].src='vpn'
firewall.@rule[10].dest='lan'

14

Odp: Dostęp z VPNa do LANu

Masz redirecty zamiast po prostu otwarcia portów.

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