Какие стоят AllowedIPs на участниках сети WG? Должны быть подходящие.
[Interface]
Address = 10.7.0.1/24
PrivateKey = hide
ListenPort = 15346
# BEGIN_PEER Mikrotik
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.2/32
# END_PEER Mikrotik
# BEGIN_PEER smartphone
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.3/32
# END_PEER smartphone
# BEGIN_PEER Xiaomi
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.4/32
# END_PEER Xiaomi
Для дальнейшей диагностики надо использовать SSH. Заходите на 0.4 и делаете:
а) ping 0.2
б) curl/wget 0.2
значит, зайдите на 0.2 и ping, traceroute, curl на 0.4,
root@OpenWrt:~# ping 10.7.0.2
PING 10.7.0.2 (10.7.0.2): 56 data bytes
64 bytes from 10.7.0.2: seq=0 ttl=64 time=0.567 ms
64 bytes from 10.7.0.2: seq=1 ttl=64 time=0.342 ms
64 bytes from 10.7.0.2: seq=2 ttl=64 time=0.344 ms
^C
--- 10.7.0.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.342/0.417/0.567 ms
root@OpenWrt:~# traceroute 10.7.0.2
traceroute to 10.7.0.2 (10.7.0.2), 30 hops max, 46 byte packets
1 10.7.0.2 (10.7.0.2) 0.048 ms 0.048 ms 0.048 ms
root@OpenWrt:~# curl 10.7.0.2
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/ DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, mu st-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GM T" />
<meta http-equiv="refresh" content="0; URL=cgi-bin/luci/" />
<style type="text/css">
body { background: white; font-family: arial, helvetica, sans-serif; }
a { color: black; }
@media (prefers-color-scheme: dark) {
body { background: black; }
a { color: white; }
}
</style>
</head>
<body>
<a href="cgi-bin/luci/">LuCI - Lua Configuration Interface</a>
</body>
</html>
root@OpenWrt:~#
traceroute to 10.7.0.4 (10.7.0.4), 30 hops max, 46 byte packets
1 10.7.0.1 (10.7.0.1) 66.576 ms 57.706 ms 66.993 ms
2 10.7.0.4 (10.7.0.4) 122.427 ms 107.681 ms 118.133 ms
curl 10.7.0.4
curl: (7) Failed to connect to 10.7.0.4 port 80 after 114 ms: Error
root@OpenWrt:~#
Также можно пропингать с 0.2 смартфон 0.3, при этом на смартфоне должно стоять AllowedIPs 0.0.0.0/0, файрволла на смартфоне быть не должно.
root@OpenWrt:~# ping 10.7.0.3
PING 10.7.0.3 (10.7.0.3): 56 data bytes
64 bytes from 10.7.0.3: seq=0 ttl=63 time=130.525 ms
64 bytes from 10.7.0.3: seq=1 ttl=63 time=146.244 ms
64 bytes from 10.7.0.3: seq=2 ttl=63 time=135.313 ms
^C
--- 10.7.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 130.525/137.360/146.244 ms
Я бы причесал AllowedIPs и воспользовался бы tcpdump. Пока можно посмотреть tcpdump на роутере 0.1 при запросе curl с 0.2 на 0.4, протокол tcp, порт 80
Вот видите. Также должен пингаться и роутер (0.4 -> 0.2 сейчас, как я понял).
root@OpenWrt:~# ping 10.7.0.2
PING 10.7.0.2 (10.7.0.2): 56 data bytes
64 bytes from 10.7.0.2: seq=0 ttl=63 time=132.892 ms
64 bytes from 10.7.0.2: seq=1 ttl=63 time=140.974 ms
64 bytes from 10.7.0.2: seq=2 ttl=63 time=128.510 ms
tcpdump -i wg0 tcp port 80
tcpdump -i wg0 tcp port 80
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wg0, link-type RAW (Raw IP), snapshot length 262144 bytes
tcpdump -i wg0 tcp port 80
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
root@homeOpenWRT:~# curl 10.7.0.2
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT" />
<meta http-equiv="refresh" content="0; URL=cgi-bin/luci/" />
<style type="text/css">
body { background: white; font-family: arial, helvetica, sans-serif; }
a { color: black; }
@media (prefers-color-scheme: dark) {
body { background: black; }
a { color: white; }
}
</style>
</head>
<body>
<a href="cgi-bin/luci/">LuCI - Lua Configuration Interface</a>
</body>
</html>
root@homeOpenWRT:~#
root@yhhf-57gffvghytf:~# tcpdump -i wg0 tcp port 80
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wg0, link-type RAW (Raw IP), snapshot length 262144 bytes
19:50:12.102813 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [S], seq 903511018, win 64860, options [mss 1380,sackOK,TS val 1264169854 ecr 0,nop,wscale 5], length 0
19:50:12.102843 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [S], seq 903511018, win 64860, options [mss 1380,sackOK,TS val 1264169854 ecr 0,nop,wscale 5], length 0
19:50:13.154094 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [S], seq 903511018, win 64860, options [mss 1380,sackOK,TS val 1264170873 ecr 0,nop,wscale 5], length 0
19:50:13.154112 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [S], seq 903511018, win 64860, options [mss 1380,sackOK,TS val 1264170873 ecr 0,nop,wscale 5], length 0
19:50:15.200444 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [S], seq 903511018, win 64860, options [mss 1380,sackOK,TS val 1264172953 ecr 0,nop,wscale 5], length 0
19:50:15.200462 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [S], seq 903511018, win 64860, options [mss 1380,sackOK,TS val 1264172953 ecr 0,nop,wscale 5], length 0
19:50:15.267481 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [S.], seq 2375035090, ack 903511019, win 64296, options [mss 1380,sackOK,TS val 2913740948 ecr 1264172953,nop,wscale 4], length 0
19:50:15.267517 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [S.], seq 2375035090, ack 903511019, win 64296, options [mss 1380,sackOK,TS val 2913740948 ecr 1264172953,nop,wscale 4], length 0
19:50:15.690047 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [P.], seq 1:72, ack 1, win 2027, options [nop,nop,TS val 1264173443 ecr 2913740948], length 71: HTTP: GET / HTTP/1.1
19:50:15.690065 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [P.], seq 1:72, ack 1, win 2027, options [nop,nop,TS val 1264173443 ecr 2913740948], length 71: HTTP: GET / HTTP/1.1
19:50:15.758196 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [.], ack 72, win 4015, options [nop,nop,TS val 2913741436 ecr 1264173443], length 0
19:50:15.758215 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [.], ack 72, win 4015, options [nop,nop,TS val 2913741436 ecr 1264173443], length 0
19:50:15.758225 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [P.], seq 1:42, ack 72, win 4015, options [nop,nop,TS val 2913741437 ecr 1264173443], length 41: HTTP: HTTP/1.1 200 OK
19:50:15.758229 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [P.], seq 1:42, ack 72, win 4015, options [nop,nop,TS val 2913741437 ecr 1264173443], length 41: HTTP: HTTP/1.1 200 OK
19:50:15.809158 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [.], ack 42, win 2026, options [nop,nop,TS val 1264173562 ecr 2913741437], length 0
19:50:15.809173 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [.], ack 42, win 2026, options [nop,nop,TS val 1264173562 ecr 2913741437], length 0
19:50:15.894480 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [P.], seq 42:1061, ack 72, win 4015, options [nop,nop,TS val 2913741555 ecr 1264173562], length 1019: HTTP
19:50:15.894497 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [P.], seq 42:1061, ack 72, win 4015, options [nop,nop,TS val 2913741555 ecr 1264173562], length 1019: HTTP
19:50:15.946894 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [.], ack 1061, win 1995, options [nop,nop,TS val 1264173698 ecr 2913741555], length 0
19:50:15.946914 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [.], ack 1061, win 1995, options [nop,nop,TS val 1264173698 ecr 2913741555], length 0
19:50:15.946926 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [F.], seq 72, ack 1061, win 2006, options [nop,nop,TS val 1264173699 ecr 2913741555], length 0
19:50:15.946929 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [F.], seq 72, ack 1061, win 2006, options [nop,nop,TS val 1264173699 ecr 2913741555], length 0
19:50:16.017425 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [F.], seq 1061, ack 73, win 4015, options [nop,nop,TS val 2913741699 ecr 1264173699], length 0
19:50:16.017443 IP 10.7.0.2.http > 10.7.0.4.46862: Flags [F.], seq 1061, ack 73, win 4015, options [nop,nop,TS val 2913741699 ecr 1264173699], length 0
19:50:16.073545 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [.], ack 1062, win 2006, options [nop,nop,TS val 1264173821 ecr 2913741699], length 0
19:50:16.073559 IP 10.7.0.4.46862 > 10.7.0.2.http: Flags [.], ack 1062, win 2006, options [nop,nop,TS val 1264173821 ecr 2913741699], length 0
^C
26 packets captured
26 packets received by filter
0 packets dropped by kernel
root@yhhf-57gffvghytf:~#
Где не туда? Вы получили веб-страницу админки роутера
The connection has timed out
The server at 10.7.0.2 is taking too long to respond.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the web.
Админка Luci активно кешируется. У вас к ней вообще доступа нет,
Смотрите tcpdump, отправляя запрос из локалки
на роутере OpenWRT AllowedIPs для пира должен стоять 10.7.0.0/24
AllowedIPs = 10.7.0.2/32, 192.168.2.0/24
, у меня, для клиентского роутера, было так (причем 0.0.0.0/24 выставил я, чтобы трафик мог ходить куда угодно): AllowedIPs = 10.7.0.4/32, 0.0.0.0/24
[Interface]
Address = 10.7.0.1/24
PrivateKey = hide
ListenPort = hide
# BEGIN_PEER Mikrotik
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.2/32, 10.7.0.0/24
# END_PEER Mikrotik
# BEGIN_PEER smarfone
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.3/32, 10.7.0.0/24
# END_PEER smartphone
# BEGIN_PEER Xiaomi
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.4/32, 10.7.0.0/24
# END_PEER Xiaomi
используйте tcpdump -i wg0 icmp и пингайте
tcpdump -i wg0 icmp
ping 10.7.0.2
пинги успешно идут.tcpdump -i wg0 icmp
выдает:root@homeOpenWRT:~# tcpdump -i wg0 icmp
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wg0, link-type RAW (Raw IP), snapshot length 262144 bytes
05:10:39.909473 IP 10.7.0.4 > 10.7.0.2: ICMP echo request, id 2, seq 1, length 64
05:10:40.033296 IP 10.7.0.2 > 10.7.0.4: ICMP echo reply, id 2, seq 1, length 64
05:10:40.910358 IP 10.7.0.4 > 10.7.0.2: ICMP echo request, id 2, seq 2, length 64
05:10:41.041817 IP 10.7.0.2 > 10.7.0.4: ICMP echo reply, id 2, seq 2, length 64
05:10:41.911119 IP 10.7.0.4 > 10.7.0.2: ICMP echo request, id 2, seq 3, length 64
05:10:42.034044 IP 10.7.0.2 > 10.7.0.4: ICMP echo reply, id 2, seq 3, length 64
05:10:42.911628 IP 10.7.0.4 > 10.7.0.2: ICMP echo request, id 2, seq 4, length 64
05:10:43.033493 IP 10.7.0.2 > 10.7.0.4: ICMP echo reply, id 2, seq 4, length 64
05:10:43.909909 IP 10.7.0.4 > 10.7.0.2: ICMP echo request, id 2, seq 5, length 64
05:10:44.043529 IP 10.7.0.2 > 10.7.0.4: ICMP echo reply, id 2, seq 5, length 64
Также ранее обманул: на роутере OpenWRT AllowedIPs для пира должен стоять 10.7.0.0/24. Это нужно, чтобы при автоматическом создании маршрутов до VPS заруливался только этот трафик, а интернет шёл мимо VPS.
config wireguard_wg0
option name 'wg0_client'
option public_key 'hide'
option preshared_key 'hide'
option route_allowed_ips '0'
option persistent_keepalive '25'
option endpoint_host 'hide'
option allowed_ips '0.0.0.0/0'
option endpoint_port 'hide'
option allowed_ips '0.0.0.0/0'
поменял на option allowed_ips '10.7.0.0/24'
option allowed_ips '10.7.0.0/24'
tcpdump -i wg0 tcp port 80
root@homeOpenWRT:~# tcpdump -i wg0 tcp port 80
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wg0, link-type RAW (Raw IP), snapshot length 262144 bytes
05:33:42.589697 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [S], seq 1546777686, win 64240, options [mss 1380,sackOK,TS val 3923878255 ecr 0,nop,wscale 7], length 0
05:33:42.712193 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [S.], seq 64876336, ack 1546777687, win 64296, options [mss 1380,sackOK,TS val 4196599335 ecr 3923878255,nop,wscale 4], length 0
05:33:42.713386 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [.], ack 1, win 502, options [nop,nop,TS val 3923878380 ecr 4196599335], length 0
05:33:42.713422 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [P.], seq 1:391, ack 1, win 502, options [nop,nop,TS val 3923878381 ecr 4196599335], length 390: HTTP: GET /cgi-bin/luci/ HTTP/1.1
05:33:42.843177 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [.], ack 391, win 4010, options [nop,nop,TS val 4196599470 ecr 3923878381], length 0
05:33:43.141650 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [P.], seq 1:77, ack 391, win 4010, options [nop,nop,TS val 4196599770 ecr 3923878381], length 76: HTTP: HTTP/1.1 403 Forbidden
05:33:43.169625 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [.], ack 77, win 502, options [nop,nop,TS val 3923878837 ecr 4196599770], length 0
05:33:43.280318 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [P.], seq 2813:3210, ack 391, win 4010, options [nop,nop,TS val 4196599914 ecr 3923878837], length 397: HTTP
05:33:43.375813 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [.], ack 77, win 502, options [nop,nop,TS val 3923879043 ecr 4196599770,nop,nop,sack 1 {2813:3210}], length 0
05:33:53.380778 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [.], ack 77, win 502, options [nop,nop,TS val 3923889046 ecr 4196599770,nop,nop,sack 1 {2813:3210}], length 0
05:33:53.516997 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [.], ack 391, win 4010, options [nop,nop,TS val 4196610136 ecr 3923879043], length 0
05:34:03.169012 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [FP.], seq 3210:3215, ack 391, win 4010, options [nop,nop,TS val 4196619799 ecr 3923879043], length 5: HTTP
05:34:03.240257 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [.], ack 77, win 502, options [nop,nop,TS val 3923898907 ecr 4196599770,nop,nop,sack 1 {2813:3216}], length 0
05:34:13.285034 IP 10.7.0.4.47506 > 10.7.0.2.80: Flags [.], ack 77, win 502, options [nop,nop,TS val 3923908950 ecr 4196599770,nop,nop,sack 1 {2813:3216}], length 0
05:34:13.419437 IP 10.7.0.2.80 > 10.7.0.4.47506: Flags [.], ack 391, win 4010, options [nop,nop,TS val 4196630057 ecr 3923898907], length 0
^C
15 packets captured
15 packets received by filter
0 packets dropped by kernel
root@homeOpenWRT:~#
# BEGIN_PEER Mikrotik
[Peer]
PublicKey = hide
PresharedKey = hide
AllowedIPs = 10.7.0.2/32, 10.7.0.0/24
Но чтобы не возиться с L7, отслеживайте именно пинги: tcpdump -i wg0 icmp,
tcpdump -i wg0 tcp port 80
?Так нельзя. Во-первых, маски перекрываются, во-вторых, с мастер-роутера должно быть только 10.7.0.2/32:
Ну и какие у вас ещё вопросы?)
Где мой тон?
фаервол выключите на всех роутерах
и маршруты на каждом из роутеров добавьте до соседней сети через wg интерфейс