macos 可以配置 OS X VPN 以在 VPN 和本地接口之间拆分流量吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3703849/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Possible to configure OS X VPN to split traffic between VPN and local interface?
提问by jph
I'm using the built-in OS X VPN tool to connect to my company's network. I notice that, when I'm connected, all traffic goes over the VPN.
我正在使用内置的 OS X VPN 工具连接到我公司的网络。我注意到,当我连接时,所有流量都通过 VPN。
In the past when I've used the Windows VPN tool I was able to configure it such that only traffic to certain IP ranges and/or host names went over the VPN and everything else went over the local network.
过去,当我使用 Windows VPN 工具时,我能够对其进行配置,以便只有特定 IP 范围和/或主机名的流量通过 VPN,其他所有流量通过本地网络。
Is that possible with a default OS X VPN? I don't see anything in the settings...
使用默认的 OS X VPN 可以吗?我在设置里看不到任何东西...
回答by kiteloop
Yes, this is possible. First, you have to remove the checkmark from "Send all traffic over VPN connection" in Settings -> Network -> Your VPN -> Advanced.
是的,这是可能的。首先,您必须在“设置”->“网络”->“您的 VPN”->“高级”中取消“通过 VPN 连接发送所有流量”中的复选标记。
Then, from the Terminal you can use "route" to add specific hosts that should be routed via your VPN.
然后,从终端,您可以使用“路由”添加应通过您的 VPN 路由的特定主机。
sudo /sbin/route add -host pandora.com -interface ppp0
In this example, "pandora.com" is the host that should be routed via the VPN and ppp0
is the name of the VPN network interface (ifconfig
shows you the list of network interfaces).
在这个例子中,“pandora.com”是应该通过 VPN 路由的主机,ppp0
是 VPN 网络接口的名称(ifconfig
显示网络接口列表)。
回答by opoloko
To make it work also with the Pandora app, you can use
要使其也适用于 Pandora 应用程序,您可以使用
sudo /sbin/route add -host internal-tuner.pandora.com -interface ppp0
and when you finish, you can simply do
当你完成时,你可以简单地做
sudo /sbin/route delete -host internal-tuner.pandora.com -interface ppp0
回答by Foliovision
I don't have reputation enough to comment on kiteloop's answer (score 28 as of today) or opoloko's answer (score 2 as of today). I was facing the same problem (listening to Pandora on OS X, 10.6.8) and am now listening to Pandora via the Pandora app (which has better sound quality I believe than via browser and certainly uses less CPU (about 3% in activity monitor).
我没有足够的声誉来评论 kiteloop 的答案(截至今天得分 28)或 opoloko 的回答(截至今天得分 2)。我遇到了同样的问题(在 OS X 10.6.8 上听 Pandora),现在我通过 Pandora 应用程序听 Pandora(我相信它比浏览器具有更好的音质,当然使用更少的 CPU(大约 3% 的活动)监视器)。
The comment from Maskime to schlingel.me does not lead to a detailed post about Pandora's IP addresses but rather to a photography weblog which does not include that post. Neither does Googling "schlingel + pandora" bring up a current location. It's a dead end.
Maskime 对 schlingel.me 的评论并未指向有关 Pandora IP 地址的详细帖子,而是指向不包含该帖子的摄影博客。谷歌搜索“schlingel + pandora”也不会显示当前位置。这是一个死胡同。
On the other hand, Opoloko's suggestion for the Pandora app works brilliantly.
另一方面,Opoloko 对 Pandora 应用程序的建议非常有效。
- Download and install the Pandora OS X app.
- Just turn off the checkmark from "Send all traffic over VPN connection" in Settings -> Network -> Your VPN -> Advanced.
- Apply changes.
- Connect your VPN.
- Open terminal.
- Run
ifconfig
. - Look for
ppp
to discover the exact location of the VPN interface whatever the ppp address is. - Include that string in opoloko's command:
sudo /sbin/route add -host internal-tuner.pandora.com -interface ppp0
- 下载并安装 Pandora OS X 应用程序。
- 只需在“设置”->“网络”->“您的 VPN”->“高级”中关闭“通过 VPN 连接发送所有流量”的复选标记。
- 应用更改。
- 连接您的 VPN。
- 打开终端。
- 运行
ifconfig
。 ppp
无论 ppp 地址是什么,查找以发现 VPN 接口的确切位置。- 在 opoloko 的命令中包含该字符串:
sudo /sbin/route add -host internal-tuner.pandora.com -interface ppp0
Additional Notes: In this case you don't need to cover a range of Pandora IP's just the internal-tuner.pandora.com address. All CDN/etc servers don't need to be covered either just the initial internal-tuner.pandora.com. While I thought one could replace internal-tuner.pandora.com
with pandora.com
this won't work. Neither will a simple wildcard like *.pandora.com
work in route. It returns a bad address warning.
附加说明:在这种情况下,您不需要覆盖 Pandora IP 的范围,而只是 internal-tuner.pandora.com 地址。不需要涵盖所有 CDN/etc 服务器,也不需要只涵盖初始的 internal-tuner.pandora.com。虽然我认为可以internal-tuner.pandora.com
用pandora.com
这个代替是行不通的。一个简单的通配符也不会*.pandora.com
在路由中工作。它返回错误地址警告。
To turn off the Pandora VPN, use opoloko's command with the correct ppp interface number:
要关闭 Pandora VPN,请使用 opoloko 的命令和正确的 ppp 接口编号:
sudo /sbin/route delete -host internal-tuner.pandora.com -interface ppp0
Happy listening. Huge thanks to opoloko who offered a simple and usable solution to what is a keen issue for music lovers since Last.FM radio went down. Pandora is the only really good suggestion algorithm left standing and which introduces a listener to new music.
听得开心。非常感谢 opoloko,他为自 Last.FM 收音机故障以来音乐爱好者的一个尖锐问题提供了一个简单且可用的解决方案。Pandora 是唯一一个非常好的建议算法,它可以向听众介绍新音乐。