A Network Tutorial/How-To Guide For The Freebsd Os: Nick Rogness
A Network Tutorial/How-To Guide For The Freebsd Os: Nick Rogness
Introduction
So what is a network interface? In plain old english, it is a logical reference to underlying network
hardware. They comprise the lowest layer of the networking subsystem, interacting with the actual
transport hardware.
It is important to understand network interfaces as they are the key to talking to your network
hardware (like Ethernet, token-ring,ATM,etc). Different network interfaces may support one or
more different protocol families, such as TCP/IP, IPX, etc.
Ifconfig The main utility for inspecting and configuring a network interface is ifconfig. First lets look
at viewing all interfaces:
# ifconfig -a
xl0: flags=8843 mtu 1500
options=3
inet 205.238.129.221 netmask 0xfffffffc broadcast 205.238.129.223
inet6 fe80::250:daff:fe77:cc77%xl0 prefixlen 64 scopeid 0x1
ether 00:50:da:77:cc:77
media: Ethernet autoselect (100baseTX )
status: active
lp0: flags=8810 mtu 1500
ppp0: flags=8010 mtu 1500
sl0: flags=c010 mtu 552
faith0: flags=8002 mtu 1500
lo0: flags=8049 mtu 16384
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6
inet 127.0.0.1 netmask 0xff000000
Now, xl0. I chose to look at xl0 because it is the logical reference to my ethernet network card I
have installed in my machine. This is not to say that every network card in FreeBSD will be
referenced by xl0. Unlike Linux, each corresponding Ethernet chipset driver is referenced differently
in FreeBSD. A full list is located in the kernel LINT file. I happen to be using a 3com network card,
for which the xl driver has been written. therefore, my network card is referenced by xl0, meaning
the first 3com network card in the machine. If I added another 3com network card to my box, it
would show up as xl1, add another and get xl2, etc, etc. I can get more information from the kernel
dmesg.boot file like so:
# ifconfig xl0
xl0: flags=8843 mtu 1500
inet 205.238.129.221 netmask 0xfffffffc broadcast 205.238.129.223
inet6 fe80::250:daff:fe77:cc77%xl0 prefixlen 64 scopeid 0x1
ether 00:50:da:77:cc:77
media: Ethernet autoselect (100baseTX )
status: active
This tells us some interesting things. The first line show the interface flags . The flags basically say
that this interfaces is UP. It is a BROADCAST type interface. It's running in SIMPLEX mode and
MULTICAST is enabled. The mtu, or Maximum Transmission Unit, is set to 1500 bytes (standard
for ethernet). The next line says inet 205.238.129.221 ... This is the IP address configuration line.
inet (meaning IPv4 family) followed by the IP address, netmask and broadcast address configured on
this ethernet interface. The next line inet6 deals with IPv6 (which I'm not covering). The next line
ether 00:50:da:77:cc:77 tells you the ethernet MAC address. The next line media: ... refers to the
media type and option of the network card. It appears my card is running at 100baseTX . This was
# ifconfig -m xl0
xl0: flags=8843 mtu 1500
options=3
capability list:
=3
inet 205.238.129.221 netmask 0xfffffffc broadcast 205.238.129.223
inet6 fe80::250:daff:fe77:cc77%xl0 prefixlen 64 scopeid 0x1
ether 00:50:da:77:cc:77
media: Ethernet autoselect (100baseTX )
status: active
supported media:
media autoselect
media 100baseTX mediaopt full-duplex
media 100baseTX
media 10baseT/UTP mediaopt full-duplex
media 10baseT/UTP
media 100baseTX mediaopt hw-loopback
Take special note of the media lines down at the bottom. To manually set them:
To set to 100BaseTX :