LinuxMint route内外网

因为驻场单位制度,办公区域不给提供外网访问,仅提供开发测试网络。由于工作原因,需要收发自家公司邮件,只能通过蓝牙链接手机热点。通常情况下,需要来回换网络链接方式,操作十分不便。还好,无论Linux还是Windows操作系统,都有route命令的支持,从此为人生节省3秒钟~

我使用的是LinuxMint系统,以下是基本操作:

route -n  #用来查看当前路由表信息

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.44.1    0.0.0.0         UG    750    0        0 bnep0
0.0.0.0         10.17.71.254    0.0.0.0         UG    20600  0        0 wlp8s0
10.17.70.0      0.0.0.0         255.255.254.0   U     600    0        0 wlp8s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 docker0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-9aaaa004a6c1
192.168.44.0    0.0.0.0         255.255.255.0   U     750    0        0 bnep0

如图, bnep0 是蓝牙热点,可以用来上外网; wlp8s0 是无线网卡,用来链接甲方提供的开发测试环境。

10.225.82.0和10.225.88.0是测试网段,增加一下路由信息:

route add -net 10.225.82.0 netmask 255.255.254.0 gw 10.17.71.254
route add -net 10.225.88.0 netmask 255.255.254.0 gw 10.17.71.254

工作结束后,删除路由信息:

route del -net 10.225.82.0 netmask 255.255.254.0
route del -net 10.225.88.0 netmask 255.255.254.0