2

想请问一下各位, Wireguard IPv4 连接没问题,但是 IPv6 却遇到下面这样的情况怎么办...

 9 months ago
source link: https://www.v2ex.com/t/966797
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  WireGuard

想请问一下各位, Wireguard IPv4 连接没问题,但是 IPv6 却遇到下面这样的情况怎么办?

  LittleState · 55 分钟前 · 42 次点击

我两台路由器使用 ipv4 连接对端时没有任何问题,但是换成 ipv6 后,我在异地使用 iperf3 测试家中的设备,除了路由器外,其他设备基本都没速度...

这是是怎么回事,我把 wg 的 mtu 已经改成了 1280 。 大概的网络环境就是下面这样

image.png

然后使用 iperf3 测速就这样

image.png

大概试了 3 种情况:

  1. OpenWrt-A 和 OpenWrt-B 上运行 wireguard 并连接,就是上面的图那样
  2. 笔记本 和 OpenWrt-A 连接,还是和 1 是一样的效果
  3. 笔记本 和 树莓派 连接,这样没任何问题,访问其他设备也是满速

两个路由器的配置

使用的 luci-app-wireguard ,基本上就只改了 mtu 为 1280

笔记本配置文件

// 笔记本
[Interface]
PrivateKey =
Address = 10.10.0.2/32
MTU = 1280

[Peer]
PublicKey = 
AllowedIPs = 10.10.0.0/24, 192.168.2.0/24
Endpoint = <ipv6-ddns-域名>:38538
PersistentKeepalive = 25

树莓派配置

[Interface]
PrivateKey = 
Address = 10.10.0.1/24
ListenPort = 38538
MTU = 1280

#replace eth0 with the interface open to the internet (e.g might be wlan0 if wifi)
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
# IP masquerading
PreUp = iptables -t mangle -A PREROUTING -i wg0 -j MARK --set-mark 0x30
PreUp = iptables -t nat -A POSTROUTING ! -o wg0 -m mark --mark 0x30 -j MASQUERADE
PostDown = iptables -t mangle -D PREROUTING -i wg0 -j MARK --set-mark 0x30
PostDown = iptables -t nat -D POSTROUTING ! -o wg0 -m mark --mark 0x30 -j MASQUERADE

# laptop
[Peer]
PublicKey = 
AllowedIPs = 10.10.0.2/32

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK