How To Setup A Static IP Address In FreeBSD

I have been using FreeBSD for a very long time, And there are some things that are quite different from Linux. When I set-up a static IP address in the latest releases of Ubuntu versions, I have to start dealing with netplan, With my experience across different Linux Distros, Some Linux networking differs across distros, So if you're looking to set up a static IP on your freeBSD server.

How To Setup A Static IP Address In FreeBSD

You will need to edit /etc/rc.conf.

vim /etc/rc.conf

You will see your network interface, it depends on how many network interface are connected to the server, and which of them you want to edit, You can make use of ifconfig command to see, which of the interface you want to edit.

In the /etc/rc.conf, You will something like this:


You will need to remove the DHCP and add "inet netmask", And also add defaultrouter="" below.
Your configuration will look like this:

ifconfig_vmx0="inet netmask"

inet: – This is the static IP we want.
netmask: – This is our network netmask
defaultrouter: – This is our network gateway

Configure DNS Server On FreeBSD

You might need to add DNS Server. To add that edit:

vim /etc/resolv.conf

And add the following DNS record. I am using Google DNS Server, You can change to DNS Server of your choice.


And save

Posted by Shehu Awwal

DevOps Engineer, Interests around Kubernetes, Infrastructure, Security & Automation.

Leave a Reply

Your email address will not be published. Required fields are marked *