k2p主路由地址:192.168.1.1
n1盒子地址:192.168.1.2
k2p添加低优先级默认路由走n1,此路由只有pppoe断开后才有效:

ip rou add default via 192.168.1$ @ y y.2 dev br-lan metric 1000

n1盒子用n– [ p 4 e p ~ L 9etplan配置无线网络默认路由和无线热点的路由优先级,默认情况下走k2– – k | Q ] [ q Pp主路由,当路由器pppoe不能连接时打开手机无线热点则自动走手机4g网络连接。0 2 h 0 m @ } t 2

network:
version: 2
renderer: networkd
ethernetse W 6:
eth0:
addresses:
- 192.168.1.2/24
dhcp4: false
dhcp6+ ) 8 7 J { A: true
accept-ra: true
#gateway4: 192.12 ( u I } E ~ G T68.1.1
routesi ` j:
- to: 0.0.0.0/0
via: 192.168L m n - x ) `.1.1
metr6 @ z R ] 8ic: 1000
nameservers:
addresses:
- 192.168.1.1
search: []
wifis:
wlan0:
dhcp4: yes
dhcp6: no
dhcp4-overrides:
route-metric: 600
access-poin, D % _ts:
"Phone-ssid":
passwo7 q ^ t ] 0rd: "www.haiyun.me"

n1盒子开启snat及网络转发:

iptables -t nat -A P- B F mOSTROUTING -o wlan0 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注