This page looks best with JavaScript enabled

Network Configuration in FreeBSD

 ·  🎃 kr0m

In this article, I explain how to configure the network in a FreeBSD system both statically and through DHCP, and how to overwrite certain parameters even after acquiring the configuration through DHCP.


Static IP:

vi /etc/rc.conf
hostname="server1.example.com"
ifconfig_em0="inet 10.10.10.100 netmask 255.255.255.0"
defaultrouter="10.10.10.1"
service routing restart

DHCP IP:

vi /etc/rc.conf
hostname="server1.example.com"
ifconfig_em0="DHCP"

If we request an IP through DHCP but want to use other DNS servers:

vim /etc/dhclient.conf

supersede domain-name-servers 8.8.8.8, 8.8.4.4;
service dhclient restart em0
If you liked the article, you can treat me to a RedBull here