Bug 209479 - Incorrect PF NAT rule set in bhyve wiki page
Summary: Incorrect PF NAT rule set in bhyve wiki page
Status: New
Alias: None
Product: Documentation
Classification: Unclassified
Component: Wiki (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Wiki Admin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-13 08:12 UTC by fehmi noyan isi
Modified: 2023-12-29 06:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fehmi noyan isi 2016-05-13 08:12:17 UTC
Hi,

In the bhyve wiki page[1], the PF rules given to enable NAT on wlan0 should be updated.

Given rule set in [1] is 

nat on wlan0 from bridge0:network to any -> (bridge0)
pass out all
pass in all


Correct rule set should be 

nat on wlan0 from (bridge0:network) to any -> (bridge0)
pass out all
pass in all


[1] https://wiki.freebsd.org/bhyve
Comment 1 fehmi noyan isi 2016-05-16 12:12:01 UTC
With the rules-set given in the Wiki page, pf fails to start and complains about an incorrect rule in line 1
Comment 2 Roman Bogorodskiy freebsd_committer freebsd_triage 2016-05-17 06:14:58 UTC
Hi, did you manage get you NAT config going?
Comment 3 fehmi noyan isi 2016-05-19 20:52:35 UTC
Hi there

Not really....In fact, I sent an email to freebsd-virtualization mailing list on the matter. 

There is also a forum discussion on the matter [1]

[1] https://forums.freebsd.org/threads/56285/
Comment 4 fehmi noyan isi 2016-05-22 22:57:17 UTC
I managed to get my VM's network connection fixed by using an indirect approach. This email [1] and this forum thread [2] have all details. 

In short, what I did was;
- assigning an static IP address to tap0 on the host machine
- assigning an static IP address to vtnet0 on the guest machine
- use tap0 IP address as the defaultrouter in rc.conf
- use pf(4) to forward traffic from tap0 to wlan0

(contents of relevant configration files are give in [2])

I did not use the bridge0 interface, in fact I removed it completely. Using static IP addresses and PF rules to redirect/NAT the traffic were all needed for me to get it working.

However, as you have more VMs around, this configuration might get hard to manage....

I still think that bhyve wiki should be updated with more information on the usage of wlan0 interface with bhyve (have seen some other posts in the Internet from people having similar/same issues) 

[1] https://lists.freebsd.org/pipermail/freebsd-virtualization/2016-May/004465.html
[2] https://forums.freebsd.org/threads/56285/