跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[WireGuard] 握手成功,但是只能单向 ping 通

发表于

通过一台公网服务器连接两个内网,内网下的主机能互相访问,大概是这样:

peer2(debian)————openwrt 路由器 1————peer1(公网服务器)————openwrt 路由器 2————peer3(unraid) 11.0.8.2 192.168.5.1 wg 地址:11.0.8.1 192.168.11.1 11.0.8.7 192.168.5.98 192.168.11.97

两个刷了 openwrt 的路由器是网关,peer1 、peer2 、peer3 是运行 wireguard 的设备,外层套 udp2raw ,udp2raw 正常连接。在 openwrt 上建立 peer 能正常互访,但是我换到其他设备( debian 和 unraid )就不行了,peer1 能 ping 通 peer2 或 peer3 ,握手也成功,peer2 和 peer3 就 ping 不通 peer1 。在 peer1 上用 tcpdump 查看,只有 echo request ,没有 echo reply 的包。不知道是 peer1 的问题还是路由器防火墙的配置问题?

配置如下: peer1: [Interface] PrivateKey = ****** Address = 11.0.8.1/24 MTU = 1200 PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o %i -j MASQUERADE PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o %i -j MASQUERADE ListenPort = 51856 [Peer] PublicKey = ****** AllowedIPs = 11.0.8.7/32 ,192.168.11.0/24 [Peer] PublicKey = ****** AllowedIPs = 11.0.8.2/32 ./udp2raw_amd64 -s -l 0.0.0.0:12345 -r 127.0.0.1:51856 -k "******" --raw-mode faketcp --seq-mode 1 --cipher-mode xor -a

peer2: [Interface] PrivateKey = ****** Address = 11.0.8.2/24 MTU = 1200 PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp2s0 -j MASQUERADE PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp2s0 -j MASQUERADE [Peer] PublicKey = ****** Endpoint = 127.0.0.1:6666 AllowedIPs = 11.0.8.0/24 ./udp2raw_amd64 -c -l 0.0.0.0:6666 -r a.b.c.d:12345 -k "******" --raw-mode faketcp --seq-mode 1 --cipher-mode xor -a

peer3(由 unraid 自动生成): [Interface] PrivateKey=****** Address=11.0.8.7 ListenPort=51820 MTU=1200 PostUp=logger -t wireguard 'Tunnel WireGuard-wg0 started' PostUp=iptables -t nat -A POSTROUTING -s 11.0.8.0/24 -o br0 -j MASQUERADE PostDown=logger -t wireguard 'Tunnel WireGuard-wg0 stopped' PostDown=iptables -t nat -D POSTROUTING -s 11.0.8.0/24 -o br0 -j MASQUERADE PostUp=ip -4 route flush table 200 PostUp=ip -4 route add default via 11.0.8.7 dev wg0 table 200 PostUp=ip -4 route add 192.168.11.0/24 via 192.168.11.1 dev br0 table 200 PostDown=ip -4 route flush table 200 PostDown=ip -4 route add unreachable default table 200 PostDown=ip -4 route add 192.168.11.0/24 via 192.168.11.1 dev br0 table 200 [Peer] PublicKey=****** Endpoint=127.0.0.1:5555 AllowedIPs=11.0.8.0/24 ./udp2raw_amd64 -c -l 0.0.0.0:5555 -r a.b.c.d:12345 -k "******" --raw-mode faketcp --seq-mode 1 --cipher-mode xor -a

感谢!

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.