由于机场有设备数量限制,而且 R1 路由器也可以申请到公网地址,所以就开了个端口,配置好 wireguard 服务, 然后可以把其他路由器的科学流量通过 dnsmasq 转发到 R1, 一起实现科学上网
R1 的地址配置为 192.168.111.1/24 和 fd08:ee99:dd11::1/80
其他客户端设备 pubkey 和地址地址,分别是 192.168.111.2 - 192.168.111.6
添加下面内容到 /etc/config/network
[email protected]:~# cat /etc/config/network
config interface 'wg1'
option proto 'wireguard'
option private_key 'uAIl9vKCfJiJf6ddesfla5HK9nng+4ncWIJXv64tmy28='
option listen_port '29008'
list addresses '192.168.111.1/24'
list addresses 'fd08:ee99:dd11::1/80'
config wireguard_wg1
option public_key 'TcnuTHV8tw6ZENbavT/iDYPN9yMZsiDBDTrCeQl8nUQ='
option route_allowed_ips '0'
list allowed_ips '192.168.111.2/32'
list allowed_ips 'fd08:ee99:dd11::2/128'
config wireguard_wg1
option public_key '7Wpe7WlNg8DaldcYfZQdC9apNDIkMmGyUrRkSHQPNH0='
option route_allowed_ips '0'
list allowed_ips '192.168.111.3/32'
list allowed_ips 'fd08:ee99:dd11::3/128'
config wireguard_wg1
option public_key 'fsdYuT+B4oVHGuupGE53qc4P8vzvN4sxYXuhUKVFRBU='
option route_allowed_ips '0'
list allowed_ips '192.168.111.6/32'
list allowed_ips 'fd08:ee99:dd11::6/128'
openwrt 客户端配置
添加下面内容到 /etc/config/network
config interface 'wg2'
option proto 'wireguard'
option private_key 'mLzmspIltslkbNzE+A85czFMfpN6A0+gQ6BTJeJPJ2A='
list addresses '192.168.111.2'
list addresses 'fd08:ee99:dd11::2'
config wireguard_wg2
option public_key 'Lx6zIekT7TzN+dfdeRLds7eTq1/s3MW/cc2wlZfYUzU=' #public key of R1
option endpoint_host 'xyz.wuruxu.cn' #IP address of R1
option endpoint_port '29008'
option route_allowed_ips '0'
option persistent_keepalive '45'
list allowed_ips '0.0.0.0/0'
list allowed_ips '::0/0'
config route
option interface 'wg2'
option target '192.168.111.0/24'
config route6
option interface 'wg2'
option target 'fd08:ee99:dd11::2/80'
配置完成
1
wuruxu OP Debian 12 环境下 Gnome Network Manager 配置连接 R1
``` root@myhosts:/etc/NetworkManager/system-connections# cat XJWQ.nmconnection [connection] id=XJWQ uuid=5b231a94-4075-4251-99fc-d511e18ac933 type=wireguard autoconnect=false interface-name=wg111 timestamp=1680876335 [wireguard] private-key=uAIl9vKCfJiJf6ddesfla5HK9nng+4ncWIJXv64tmy28= [wireguard-peer.Lx6zIekT7TzN+MRMmRLds7eTq1/s3MW/cc2wlZfYUzU=] endpoint=xyz.wuruxu.cn:29008 persistent-keepalive=30 allowed-ips=0.0.0.0/0;::/0; [ipv4] address1=192.168.111.6/24 dns=192.168.111.1; method=manual route1=192.168.111.6/24,192.168.111.1 [ipv6] addr-gen-mode=stable-privacy address1=fd08:ee99:dd11::6/80 dns=fd08:ee99:dd11::1; method=manual route1=fd08:ee99:dd11::6/80,fd08:ee99:dd11::1 [proxy] ``` |