Configuring FreeBSD network interface

View interfaces

This manual explains how to configure one of interfaces.

First of all, enter the command that will list all interfaces of the server

ifconfig -a

freebsd ifconfig-a

For example, let's configure em1 interface

Installation of Nano

We will need an editor to make the following settings. Let's install it from the repository.  We will use the editor "nano". Input the following command:

pkg install nano

During the installation process, you will be prompted to agree to continue the installation; Agree

agree to continue the installation

Now when the editor is installed, our configuration file can be edited.

Configuring interface

Enter the command:

nano /etc/rc.conf

The editor with the interface configuration file will open; go down to the end of records and enter the following values beginning a new line:

ifconfig_em1=“inet 192.168.0.1 netmask 255.255.255.0“

Save the changes „Ctrl + O“ and "Enter" , Exit the editor „Ctrl + X“

Start interface

Next, enter the command to restart the network services of our server

service netif restart && service routing restart

freebsd restart the network services

After successful reboot, re-enter "ifconfig"

freebsd re-enter "ifconfig"

The interface we configured is ready for use