# Vtnet0 interface not being created



## Mike G (Jul 20, 2021)

Hi, I am fairly new to FreeBSd and network administration so this might be down to my ignorance, but I am having a problem because the vtnet0 interface is not being created on my server a boot time, and I can't set it up using either "dhclient vtnet0" or several different attempts at ifconfig (all of which return that the interface vtnet09 does not exist).  I have tried adding "ifconfig_vtnet0=" lines to my rc,conf file and rebooting (using either DHCP , the IP address given to my machine by my router or my dynamic domain name), none of which have worked.  Looking at the boot messages, there is no sign of any failed attempt to create vtnet0, though Lo0 and Em0 are both created set "up" and work perfectly well, I realise this is probably a foolish question, and the answer is staring me in the face somewhere, but I promise I have spent quite a bit of time searching for an answer and can not find one (the only mention I can find of similar problems is when setting up a jail, and nothing there seems to solve the problem).


----------



## Jose (Jul 20, 2021)

The vtnet(4) driver is only for virtual machines. It looks like you're running Freebsd on real hardware that has an Intel NIC that uses the em(4) driver.

Add the appropriate `ifconfig_emX` line to your /etc/rc.conf to bring this interface up on boot.

The handbook section on network administration covers finding which driver has been found for your hardware and configuring the NIC in detail:








						Chapter 13. Configuration and Tuning
					

This chapter explains much of the FreeBSD configuration process, including some of the parameters which can be set to tune a FreeBSD system.




					docs.freebsd.org


----------



## Mike G (Jul 20, 2021)

Thanks, yes it is on a real machine and I did think the "V" in vtnet might stand for virtual; I was following a guide for setting some rules for PF that simply assumed vtnet0 was present, will read the chapter and hopefully get a better handle on the problem.


----------



## SirDice (Jul 20, 2021)

On a lot of Linux distributions it's more common to see a eth0 regardless of the actual driver of that network card. On FreeBSD however, network interfaces are named after their drivers. So the actual name of the interface is going to depend on the exact hardware you have. You can have a re0 for Realtek (re(4)) cards or em0 for Intel (em(4)) cards for example. The vtnet(4) driver is a paravirtualized network interface used on a lot of virtual machines.


----------



## Jose (Jul 20, 2021)

SirDice said:


> On a lot of Linux distributions it's more common to see a eth0 regardless of the actual driver of that network card...


Those were simpler times. Interface naming is a lot more modern and sophisticated in current-day Linux:





						NetworkInterfaceNames - Debian Wiki
					






					wiki.debian.org


----------



## SirDice (Jul 20, 2021)

Jose said:


> Interface naming is a lot more modern and sophisticated in current-day Linux:


It's just not the kernel anymore that names it, you still end up with a eth0 most of the time because that's what everyone's used to. 

If it helps you can rename the interface if you want. The `ifconfig_DEFAULT` is quite useful if there's only one interface, it will automatically pick the first network interface it finds. 


```
ifconfig_DEFAULT_name="eth0"
ifconfig_eth0="inet .... netmask ..."
```
Or just use it directly:

```
ifconfig_DEFAULT="inet ... netmask ..."
```


----------

