Network interface

A network interface is the interface to a network node or a certain Network Interface Card (NIC) perhaps an  ethernet card. An interface can be virtual or physical. To see all network interfaces on a system use the ifconfig command.

$ ifconfig -a lo0: flags=8049 mtu 33192 groups: lo         inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x9 wi0: flags=8843 mtu 1500 lladdr 00:02:2d:09:4b:44 media: IEEE802.11 autoselect (DS2) status: active ieee80211: nwid ATLAS -12dBm (auto) inet 10.0.0.2 netmask 0xff000000 broadcast 10.255.255.255 inet6 fe80::202:2dff:fe09:4b44%wi0 prefixlen 64 scopeid 0x1 xl0: flags=8843 mtu 1500 lladdr 00:60:08:5a:86:82 media: Ethernet 100baseTX full-duplex status: no carrier inet 172.16.2.2 netmask 0xfffffe00 broadcast 172.16.3.255 inet6 fe80::260:8ff:fe5a:8682%xl0 prefixlen 64 scopeid 0x2

When a computer has multiple network interfaces and passes IP traffic from one interface to another interface it is called a router. Similarely if a computer passes ethernet frames from one NIC to another it is called a bridge.

If you want to be sure that traffic is being routed or bridged you can attach a bpf program like tcpdump to a network interface and watch a packet entering interface a and exiting on interface b.

Network interfaces are distinguished by a type, ie. lo, xl, wi, pppoe, ppp, tun, and so on, and a network interface number in case there is more than one of it's type ie. lo0, lo1, lo2.

The length of an interface name in OpenBSD is limited by IFNAMSIZ (16) which is found in /usr/include/net/if.h.