Basic VM Networking Tutorial

JavaScriptDude

Dabbler
Joined
Nov 5, 2011
Messages
22
I am running FreeNAS 11.3 and created my first VM and have found it very difficult to figure out how to get basic networking functioning for my VM.

My goal is to create a VM via the "Virtual Machines" GUI in the FreeNAS web UI on a FreeNAS host with only one Ethernet port. I want to assign the VM its own IP address on the same network as the FreeNAS host and the VM must be able to talk to the FreeNAS host for SMB access.

Are there any good guides out there on how to do this with FreeNAS 11.3?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
How did you create the VM? Via the GUI or via a CLI tool? The GUI takes care of all the network setup in the background, and it's mostly transparent and just works.
 

JavaScriptDude

Dabbler
Joined
Nov 5, 2011
Messages
22
I have only used the web GUI so far. I will try it again but I was not able to get the VM to talk to the FreeNAS host. I will give it another try.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
OK, can you provide the output of ifconfig -a on your FreeNAS host? The way the networking is supposed to work is:

bridge0
groups: bridge
member: tap0 <- used for VM1
member: tap1 <- used for VM2
...
member: vnet0.1 <- used for jail 1
member: vnet0.2 <- used for jail 2
...
member: host NIC

host NIC: flags=xxx<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,...> <- PROMISC bit has to be set

Within each VM, the guest gets the configured MAC address, and should get a DHCP address on the same subnet as the host. So long as both have the same default gateway, they can talk to each other, barring local firewall settings. FreeNAS by default doesn't run a local firewall. The guest may need to disable any local firewalls to work.
 

JavaScriptDude

Dabbler
Joined
Nov 5, 2011
Messages
22
I have created and destroyed VMs several times as well as mucked around in the networking GUI to try to get things working but have avoided doing anything outside of the GUI. Note: I'm only using em0. I'm ignoring em1 and bge0 for now. I have one VM and have assigned it to em0. I've configured the VM to use a static IP of 192.168.5.7/24 with the same gateway as the host of 192.168.5.1

The FreeNAS host at 192.168.5.5 can ping the VM but not visa versa. I can ping the FreeNAS host and the VM from another physical host on the same network so it should not be a firewall issue.

Here is my ifconfig output:
root@freenas[~]# ifconfig
em0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:15:17:bb:a1:4a
hwaddr 00:15:17:bb:a1:4a
inet 192.168.5.5 netmask 0xffffff00 broadcast 192.168.5.255
inet 192.168.5.6 netmask 0xffffff00 broadcast 192.168.5.255
inet 192.168.5.7 netmask 0xffffff00 broadcast 192.168.5.255
nd6 options=9<PERFORMNUD,IFDISABLED>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:15:17:bb:a1:4b
hwaddr 00:15:17:bb:a1:4b
nd6 options=9<PERFORMNUD,IFDISABLED>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
bge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
ether 00:25:b3:c8:56:73
hwaddr 00:25:b3:c8:56:73
nd6 options=1<PERFORMNUD>
media: Ethernet autoselect
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
groups: lo
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 02:dc:55:d7:0b:00
nd6 options=1<PERFORMNUD>
groups: bridge
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 8 priority 128 path cost 2000000
member: vnet0.2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 7 priority 128 path cost 2000
member: vnet0.1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 6 priority 128 path cost 2000
member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 1 priority 128 path cost 20000
vnet0.1: flags=8942<BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: associated with jail: plexmedia as nic: epair0b
options=8<VLAN_MTU>
ether 00:25:b3:d2:9c:aa
hwaddr 02:e8:10:00:06:0a
nd6 options=1<PERFORMNUD>
media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
status: active
groups: epair
vnet0.2: flags=8942<BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: associated with jail: scr as nic: epair0b
options=8<VLAN_MTU>
ether 00:25:b3:65:28:8b
hwaddr 02:e8:10:00:07:0a
nd6 options=1<PERFORMNUD>
media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
status: active
groups: epair
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: Attached to Ubuntu2004LTS
options=80000<LINKSTATE>
ether 00:bd:16:ee:ae:00
hwaddr 00:bd:16:ee:ae:00
nd6 options=1<PERFORMNUD>
media: Ethernet autoselect
status: active
groups: tap
Opened by PID 10567
~
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Your em0 interface has 3 IPs, one of which conflicts with the VM.
inet 192.168.5.5 netmask 0xffffff00 broadcast 192.168.5.255
inet 192.168.5.6 netmask 0xffffff00 broadcast 192.168.5.255
inet 192.168.5.7 netmask 0xffffff00 broadcast 192.168.5.255

How did you set this up?
 

JavaScriptDude

Dabbler
Joined
Nov 5, 2011
Messages
22
Networking -> Interfaces -> em0 (Edit) -> Add IP Address
I plan on having multiple VMs in the future and wanted to have VNC available on different ports so I initially added 192.168.5.6 so I can map VNC to it. I then added 192.168.5.7 for the VM.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
No, please delete those extra IPs. The guests will use those IPs within their respective tap interfaces. And you can define the specific VNC port within the VNC device attached to the VM.
 

JavaScriptDude

Dabbler
Joined
Nov 5, 2011
Messages
22
I was just trying that as you responded and can confirm that this fixed the issue. I can now ping the host from the VM. I'm going to do an end to end run through again to make sure I got it down. Seems like it should be straight forward via the GUI =)

Thank you!
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
You're welcome.
 

JavaScriptDude

Dabbler
Joined
Nov 5, 2011
Messages
22
FYI - When I had VNC on another IP and I clicked on the `<--> VNC` button it always launches the host IP and not the IP address assigned to the VNC device . I had to manually change the URL to get No VNC to load. Should I raise this as a ticket?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Can't help you there. I always use TightVNC and PuTTY tunneling for VNC access.
 
Top