Created
May 20, 2016 15:42
-
-
Save fivesmallq/7d864a298ca02ed09f236bc1b5612bc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
思路就是 | |
1. 把wifi设置成优先的default路由 | |
2. 配置内网的网段走有线的网关 | |
3. 除了有线的, 自然就是走wifi default了 | |
走起. | |
1. 网络偏好设置里面, 把wifi调整为最高优先级 | |
2. 添加路由 | |
route add -net 192.168.0.0/16 172.16.142.251 | |
3. route add -net 10.0.0.0/8 172.16.142.251 | |
4. | |
上面的是外网 | |
下面的是内网网段 | |
由于某些原因,我需要在机器上设置静态路由,但是每次机器sleep再wake后,可能网络环境已经变了(比如从一个wifi信号换到了另外一个),所以之前的静态路由可能已经失效. | |
这时可以这样删除之前已经设置的静态路由: | |
sudo route -n flush | |
这条命令可能要执行多次.直至没有输出为止. | |
然后加入新加入的网络的网关: | |
sudo route add default <new gateway IP> | |
或者重新断开网络,连接下 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment