Oxw*_*ivi 8 network-manager vpn openvpn
当我连接到 VPN 时,我的所有网络流量都会自动通过它路由。有没有办法增加豁免?我不知道添加例外是否与VPN协议有关,但我使用的VPN是OpenVPN协议的。
说到 OpenVPN,为什么它不像 PPTP 那样默认安装在 Ubuntu 上?
我无法获得 IRCHighWay 的服务器列表,这就是我尝试通过运行 bash 脚本连接 XChat 的结果:
* Looking up irc.irchighway.net
* Connecting to irc.irchighway.net (65.23.153.98) port 6667...
* Connected. Now logging in...
* You have been K-Lined.
* *** You are not welcome on this network.
* *** K-Lined for Open proxies are not allowed. (2011/02/26 01.21)
* *** Your IP is 173.0.14.9
* *** For assistance, please email banned@irchighway.net and include everything shown here.
* Closing Link: 0.0.0.0 (Open proxies are not allowed. (2011/02/26 01.21))
* Disconnected (Remote host closed socket).
Run Code Online (Sandbox Code Playgroud)
由于我的 VPN,IP 173.0.14.9 是其中之一。我ip route list在运行脚本之前忘记检查了,这是运行它之后的一个:
~$ ip route list
99.192.193.241 dev ppp0 proto kernel scope link src 173.0.14.9
173.0.14.2 via 192.168.1.1 dev eth1 proto static
173.0.14.2 via 192.168.1.1 dev eth1 src 192.168.1.3
192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.3 metric 2
169.254.0.0/16 dev eth1 scope link metric 1000
default dev ppp0 proto static
Run Code Online (Sandbox Code Playgroud)
哦,运行脚本返回了这个输出:
~$ sudo bash irc_route.sh
Usage: inet_route [-vF] del {-host|-net} Target[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Target[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Target[/prefix] [metric M] reject
inet_route [-FC] flush NOT supported
Run Code Online (Sandbox Code Playgroud)
我在连接到 VPN 后运行了脚本。
创建一个文件 irc_route.sh,其中包含:
#!/bin/bash
# script to make connections to irc.irchighway.net go via DEV.
DEV=eth0
GW=$(ip route list | sed "s/.* via \([0-9.]*\) dev $DEV.*/\1/;t;d"|head -1)
route add -host irc.irchighway.net gw $GW $DEV
Run Code Online (Sandbox Code Playgroud)
将 DEV 更改为您从中获得 Internet 连接的接口(可能是 wlan0、eth1、eth0、ppp0 中的任何一个)。然后用 运行脚本sudo bash irc_route.sh,可以通过ip route list前后运行查看结果。
DEV 设备上 Internet 流量的默认网关的 IP 存储在变量 GW 中,然后用于通过您的默认 GW 而不是您拥有的 OpenVPN 连接路由所有流向 irc.irchighway.net 服务器的流量。
要使所有 IRCHighWay 服务器都可以使用,您必须获得所有服务器的列表。
server_list.txt:
irc.irchighway.net
caliburn.pa.us.irchighway.net
Run Code Online (Sandbox Code Playgroud)
脚本:
#!/bin/bash
# script to make connections to irchighway go via DEV.
DEV=eth0
GW=$(ip route list | sed "s/.* via \([0-9.]*\) dev $DEV.*/\1/;t;d"|head -1)
cat server_list.txt| xargs -iSERVER route add -host SERVER gw $GW $DEV
Run Code Online (Sandbox Code Playgroud)
有一个“更简单”的解决方案,您可以基于此标记端口和路由,请参阅iproute2 教程, 但我没有使用过。如果您不知道自己在做什么,那么这种路由就会出现一些问题。
| 归档时间: |
|
| 查看次数: |
4768 次 |
| 最近记录: |