k2p主路由地址:192.168.1.1
n1盒子地址:192.168.1.2
k2p添加低优先级默认路由走n1,此路由只有pppoe断开后才有效:
ip rou add default via 192.168.1.2 dev br-lan metric 1000
n1盒子用netplan配置无线网络默认路由和无线热点的路由优先级,默认情况下走k2p主路由,当路由器pppoe不能连接时打开手机无线热点则自动走手机4g网络连接。
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 192.168.1.2/24
dhcp4: false
dhcp6: true
accept-ra: true
#gateway4: 192.168.1.1
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
metric: 1000
nameservers:
addresses:
- 192.168.1.1
search: []
wifis:
wlan0:
#防止开机时wlan0未连接导致systemd-networkd-wait-online阻塞系统启动
optional: true
dhcp4: yes
dhcp6: no
dhcp4-overrides:
route-metric: 600
access-points:
"Phone-ssid":
password: "www.haiyun.me"
n1盒子开启snat及网络转发:
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1
标签:k2p, n1, 宽带手机热点多线路切换