Temat: wireguard - troubleshooting routingu
Czesc
Mam dosc nietypowy problem i prawdopodobnie jest gdzies coś zepsute z routingiem. Moja siec wygląda następująco:
1. Dwa Rotuery - MIR3G (wg0: 10.9.0.1) i NEXX3020 (wg0: 10.9.0.10) które widza się w sieci. Dodatkowo Client1 (192.168.100.x) pinguje klinetów zza routera Mir3g (192.168.0.x). Niestety w druga stronę to nie działa i tu jest pierwszy problem.
2. Chcialbym zeby Cilent1 mial tylko polaczenie z trzema podsieciami (wireguard 10.9.0.x, mir3G 192.168.0.x, 192.168.100.x-lokalna) a główne wyjście na świat wychodziło własnym ISP do którego pozniej sie podepne (ISP2 zamiast ISP1). Poki co bedzie wychodzić przez MIR3G.

Konfiguracja serwera (MIR3g)
/etc/config/network
root@Gargoyle:~# cat /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'
option ula_prefix 'fd2a:66ae:6778::/48'
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'
option dns '8.8.8.8 8.8.4.4'
config device 'lan_dev'
option name 'eth0.1'
option macaddr '50:64:2b:1a:6a:fc'
config interface 'wan'
option ifname 'eth0.2'
option proto 'dhcp'
option macaddr '20:28:18:a1:64:c6'
option ipv6 '0'
option dns '8.8.8.8 8.8.4.4'
option peerdns '0'
config interface 'wan6'
option ifname 'eth0.2'
option proto 'dhcpv6'
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 '1 6t'
config interface 'wg0'
option proto 'wireguard'
option private_key '<cut>'
option listen_port '55055'
list addresses '10.9.0.1/24'
config wireguard_wg0
option public_key '<cut>'
option route_allowed_ips '1'
list allowed_ips '0.0.0.0/0'
option persistent_keepalive '25'
option description 'openwrt'/etc/config/firewall
cat /etc/config/firewall
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
option enforce_dhcp_assignments '1'
config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone
option name 'wan'
list network 'wan'
list network 'wan6'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
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'
option reload '1'
config include
option type 'script'
option path '/usr/lib/gargoyle_firewall_util/gargoyle_additions.firewall'
option family 'IPv4'
option reload '1'
config include 'openvpn_include_file'
option path '/etc/openvpn.firewall'
option reload '1'
config zone 'vpn_zone'
option name 'vpn'
option device 'tun0'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
option mtu_fix '1'
option masq '1'
config forwarding 'vpn_lan_forwarding'
option src 'lan'
option dest 'vpn'
config forwarding 'lan_vpn_forwarding'
option src 'vpn'
option dest 'lan'
config remote_accept 'ra_openvpn'
option zone 'wan'
option local_port '1194'
option remote_port '1194'
option proto 'udp'
config forwarding 'vpn_wan_forwarding'
option src 'vpn'
option dest 'wan'
config rule
option src 'wan'
option target 'ACCEPT'
option proto 'udp'
option dest_port '55055'
option name 'wireguard'
config zone
option name 'wg'
option input 'ACCEPT'
option forward 'ACCEPT'
option output 'ACCEPT'
option masq '1'
option network 'wg0'
config forwarding
option src 'wg'
option dest 'wan'
config forwarding
option src 'wan'
option dest 'wg'
config forwarding
option src 'wg'
option dest 'lan'
config forwarding
option src 'lan'
option dest 'wg'route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eth0.2
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
10.9.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0.2wireguard client (nexx-3020)
network
cat /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'
option ula_prefix 'fd77:6c2c:58ab::/48'
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.100.1'
option dns '8.8.8.8 8.8.4.4'
config device 'lan_eth0_1_dev'
option name 'eth0.1'
option macaddr '20:28:18:a1:29:f6'
config interface 'wan'
option proto 'dhcp'
option ipv6 '0'
option ifname 'eth0.2'
option dns '8.8.8.8 8.8.4.4'
option peerdns '0'
option macaddr '20:28:18:a1:29:1a'
config device 'wan_eth0_2_dev'
option name 'eth0.2'
option macaddr '20:28:18:a1:29:f7'
config interface 'wan6'
option ifname 'eth0.2'
option proto 'dhcpv6'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '4 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '0 6t'
config interface 'wg0'
option proto 'wireguard'
option private_key '<cut>'
list addresses '10.9.0.10/32'
config wireguard_wg0
option public_key '<cut>'
option route_allowed_ips '1'
list allowed_ips '0.0.0.0/0'
option endpoint_host 'xxxxxxxx.noip.pl'
option endpoint_port '55055'
option persistent_keepalive '25'
option description 'openwrt'firewall
cat /etc/config/firewall
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'lan'
list network 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
config zone
option name 'wan'
list network 'wan'
list network 'wan6'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
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'
option reload '1'
config include
option type 'script'
option path '/usr/lib/gargoyle_firewall_util/gargoyle_additions.firewall'
option family 'IPv4'
option reload '1'
config rule
option src 'wan'
option target 'ACCEPT'
option proto 'udp'
option dest_port '55055'
option name 'wireguard'
config zone
option name 'wg'
option input 'ACCEPT'
option forward 'ACCEPT'
option output 'ACCEPT'
option masq '1'
option network 'wg0'
config forwarding
option src 'wg'
option dest 'wan'
config forwarding
option src 'wan'
option dest 'wg'
config forwarding
option src 'wg'
option dest 'lan'
config forwarding
option src 'lan'
option dest 'wg'
config remote_accept 'ra_443_443'
option local_port '443'
option remote_port '443'
option proto 'tcp'
option zone 'wan'
config remote_accept 'ra_80_80'
option local_port '80'
option remote_port '80'
option proto 'tcp'
option zone 'wan'
config remote_accept 'ra_22_22'
option local_port '22'
option remote_port '22'
option proto 'tcp'
option zone 'wan'route -n
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 wg0
188.122.0.24 192.168.10.1 255.255.255.255 UGH 0 0 0 eth0.2
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0.2
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lanCzy powinienem jakos polaczyc interfejs wg0 i LAN (w jedną zonę) ? Z drugiej strony forwarding wg/lan jest zrobiony.
nexx3020 (192.168.100.1)
traceroute to 192.168.0.6 (192.168.0.6), 30 hops max, 38 byte packets
1 10.9.0.1 (10.9.0.1) 0.940 ms 1.220 ms 1.460 ms
2 192.168.0.6 (192.168.0.6) 1.740 ms 1.180 ms 1.300 msmir3g (192.168.0.1)
root@Gargoyle:~# ping 10.9.0.10 -c 1
PING 10.9.0.10 (10.9.0.10): 56 data bytes
64 bytes from 10.9.0.10: seq=0 ttl=64 time=1.650 ms
--- 10.9.0.10 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 1.650/1.650/1.650 ms
natomiast do 192.168.0.x juz pakiet nie wraca
root@Gargoyle:~# traceroute 192.168.100.1
traceroute to 192.168.100.1 (192.168.100.1), 30 hops max, 38 byte packets
1 192.168.10.1 (192.168.10.1) 0.438 ms 0.388 ms 0.308 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *