wireguard 手动添加的路由不生效?

我得客户端,linxu,配置文件中
AllowedIPs 里面添加了118.184.169.32这个ip
当我执行 wg-quick up wg 以后,路由也自动添加

[#] ip link add hongkong2 type wireguard
[#] wg setconf hongkong2 /dev/fd/63
[#] ip -4 address add 10.10.8.3/24 dev hongkong2
[#] ip link set mtu 1420 up dev hongkong2
[#] ip -4 route add 118.184.169.32/32 dev hongkong2 #添加路由

使用curl,可以获取到ip地址

[root@VM-12-15-centos wireguard]# curl ip.3322.net
34.113.1.31

之后我手动添加了路由,

ip -4 route add 34.160.111.145/32 via 10.10.8.1 dev hongkong2

却提示错误的连接

[root@VM-12-15-centos wireguard]# curl ifconfig.me
curl: (7) Failed connect to ifconfig.me:80; No route to host

wireguard只能通过AllowedIPs配置路由吗

阅读 1.9k
1 个回答

解决了,路由配置的问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进