-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
virtio-net / vmnet does not properly NAT packets going out through Cisco VPN #84
Comments
any update to this one? I encountered the same issue |
Did you file a bug report with Apple? |
It sounds like there is a pf rule that needs to be set up for anything leaving into the utun0 tunnel. |
Yeah, that's pretty much how far I got as well.
```
nat pass on utun0 from (bridge100:network) to any -> (utun0)
```
Will make packets go out properly NATed, return to the interface, but then
get dropped somewhere else.
|
Did you notice that if you bring up dlite after you connect to VPN everything is working correctly? |
I've done that a few times before, doesn't work. Maybe different types of VPN? |
Any updates on this? Bit of a deal-breaker for using xhyve in a work environment. |
Any updates on this? It's preventing me from using xhyve on my dev boxes |
Docker's xhvye fork seems to have found a way around this issues. Guess we have to wait for their source drop. |
I ran into this. I run two VPN, one is a openconnect (not working) and one is a OpenVPN (working). 198.41.0.0/16 is behind openconnect and the rest of the internet is behind OpenVPN. If I ping 8.8.8.8 from the VM, here's a capture of bridge100 and here is the capture of utun1 If I ping 198.41.x.x from the VM, here's a capture of bridge100 and here is the capture of utun0 The difference is obviously that NAT is happening on utun1 <-> bridge100 but not utun0 <-> bridge100 |
Got it to work. I followed the instructions here https://kfigiela.github.io/2014/11/07/using-native-os-x-nat-with-virutalbox/ and added the following to my
I also configured my openconnect script to use interface utun9 and to run Now, however, the other VPN stopped working -.- I suspect that's because I flushed the pf ruleset while loading these. Interestingly, a |
PF on OS X supports anchors and allows scripts to load/unload rules on the fly using the anchors. Find a good anchor and use it along with pfctl, this way you don't break any existing rules or ones added on the fly by various system components. |
@bertjwregeer I was just reading http://www.openbsd.org/faq/pf/anchors.html and trying What do you mean with "Find a good anchor"? |
AFAIK the anchor needs to be rooted in pf.conf, otherwise it is not
effective.
Something like nat-anchor yourname, and then add rules to yourname.
You might also be able to attach to the apple internet connection sharing
anchor, although I could not get that working.
|
anchor's have to be defined in your pf.conf, you can't just add a new anchor on the fly. Apple's default pf.conf specifically comes with That is where all the current NAT rules will be dynamically added (for VM's and the like). Anchors can be nested too... You should be able to say:
For example to nest under the existing com.apple anchor. Then later you can flush all rules for your anchor, thereby removing it gracefully from the firewall.
Now your anchor goes away. Note I haven't tested this on OS X, this is mainly based upon knowledge of anchors on OpenBSD. |
Filippo, you said the openvpn utun1 works? Could you post the output of
ifconfig for the two tun devices? Maybe open connect is not setting some
flag that makes vmnet.framework ignore it.
|
@bertjwregeer @lmb awesome, thanks! The following "simple" lines work flawlessly now, without interfering with the other VPN. After connecting, specifying interface utun9 (with hardcoded bridge100 IPs to work even if the docker-machine is down):
When disconnecting or before connecting to cleanup:
|
Welcome :-). |
@lmb you are right we should still figure out why automatic NAT was missing. I don't see any difference here
Or in the routes
|
utun9 has a different netmask than utun0. Maybe this makes vmnet think that |
Had the same issue with openvpn not working from within the guest. can confirm this worked for me:
(replace I often use more than a single vpn, though -- so this solution is a little awkward. To really make it seamless, it seems like I'd need to modify my vpn configs to run these commands as scripts after the vpn is connected |
For what it's worth, this isn't working for me anymore. Same as TheNewNormal/kube-solo-osx#139. |
Here's a somewhat more generalized script to get this working here: https://gist.github.com/mowings/633a16372fb30ee652336c8417091222 This is safe to run automatically when any of your vpns come up -- it flushes existing rules before re-natting |
@mowings: Your script seems to work for me. Will this be fixed in xhyve so the script is not necessary? |
Hi,
I've noticed that xhyve with virtio-net does not properly NAT packets that need to reach a VPNed host.
I verified this by pinging hosts on the public internet (google.com) and behind the VPN and observing with Wireshark.
Any idea what could be causing this? Where can I look for more information? Finding docs on vmnet.framework is surprisingly difficult.
The text was updated successfully, but these errors were encountered: