Hello ladies and gentlemen,
As said, about one year ago, i now open the BSD category !!! What’s up!? ^^
So, today, i’ll teach how to configure network interfaces under FreeBSD…
Linux and FreeBSD are Unix systems (actually Linux is not really a Unix system … but a derivate) so we can guess that the network configuration is the same, but not really.
We are still using the same command: ifconfig, but with a slight difference. Here’s the basic syntax of the command under FreeBSD:
ifconfig <netif> <net_class> <address> [netmask <netmask>]
Here we can see difference parameters that we need to give to be able to configure our interface, but first we have to get the name of the interface. The net class would be for us inet (for IPV4).
Under Linux, it would have been ethX, raX or wlanX but under BSD, naming are quite different. For Linux, the naming is based on the link characteristics (ethernet …), but BSD will create the interface name according to the driver.
So you will have to get first the name of the interface on which you want to apply your configuration using:
Here we can see that we have the loopback interface (lo0) and a NIC (em0).
Note that on BSD, you can change the name of the interface using the following command:
So, now to put an IP, we will have for example:
That’s about it.
Now, we will just see how to configure network interface automatically at boot.
You just have to edit the file /etc/rc.conf and add the corresponding lines:
Reboot, and your interface will then have the name eth0 with the corresponding IP.
Isn’t it easier than on Ubuntu (for Ubuntu users :P)? He he
Any comments appreciated ^^