无线有线双网卡同时工作(deepin)

前言:

     有线网(公司):172.16.224.199     网关:172.16.224.254  (手工) 

     无线网(手机):192.168.43.193     网关:192.168.43.1(自动获取)

1.查看路由

  Kernel IP routing table     

  Destination    Gateway        Genmask        Flags Metric Ref    Use Iface

  default        192.168.43.1    0.0.0.0        UG    600    0        0 wlp2s0

  default        172.16.224.254  0.0.0.0        UG    20100  0        0 eth0

2.修改有线网络路由

   删除有线网卡路由

    route del -net default netmask 0.0.0.0 dev eth0

    添一条路由

    route add -net 172.0.0.0 netmask 255.0.0.0 gw 172.16.224.254 dev eth0

   只要访问172.0.0.0  都从172.16.224.254走.

成功!

补充:由于重启之后路由会恢复,所以我们把它放配置文件中:

vim /etc/NetworkManager/dispatcher.d/02myroutes

里面写:

#!/bin/bash

route del -net default netmask 0.0.0.0 dev eth0

route add -net 172.0.0.0 netmask 255.0.0.0 gw 172.16.224.254 dev eth0

wq!保存退出!

成功!!!

发布了18 篇原创文章 · 获赞 1 · 访问量 544

猜你喜欢

转载自blog.csdn.net/m0_37694106/article/details/104009637
今日推荐