Solved Meaning of network interface name

marcus123

Member

Reaction score: 3
Messages: 37

For the network interface name, I always see em0 / lo0, do they have any special meaning?

I have a FreeBSD 12.2 image, it is em0 when it runs on VirtualBox, but when I move it to MS Hyper-v, it becomes de0, why is it changed and what does de0 mean? Can I fix it to em0 always?

Many thanks.
 

covacat

Well-Known Member

Reaction score: 198
Messages: 424

usually comes from the nic's chipset vendor/model/nickname
de0 used to be digital equipment chipset
man 4 de
when freebsd is run as a guest os nic chipset is emulated by the host so they can be whatever
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,038
Messages: 38,488

lo(4) is a special interface though, it's always there (except in jails). It's the loopback interface and typically has 127.0.0.1 and ::1 assigned to it. The other interface names are going to depend on the driver, em(4) is for Intel cards, re(4) is certain Realtek cards, etc.

Can I fix it to em0 always?
Please don't do this, em(4) is expected to be an Intel card. It would confuse the heck out of anybody else that has to maintain that system if it's attached to a Realtek (or some other branded) card.

You can rename your card though,
Code:
ifconfig_em0_name="eth0"
From there on you can refer to the interface as eth0.

Another option is to use the special _DEFAULT tag:
Code:
ifconfig_DEFAULT="dhcp"
This will always refer to the first ethernet interface the system can find. Useful for VMs that only have one interface and you might switch between vtnet(4) or any of the other emulated interfaces.
 
OP
marcus123

marcus123

Member

Reaction score: 3
Messages: 37

Thanks all, so I have to use ifconfig to check the available interface first, then update it in rc.conf everytime changing machine or nic, correct?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,038
Messages: 38,488

so I have to use ifconfig to check the available interface first, then update it in rc.conf everytime changing machine or nic, correct?
Yes, or use ifconfig_DEFAULT, which works great if there's only one interface.
 
Top