Megapipe Communications

FreeBSD Networking

FreeBSD configures networking a little differently than Linux-based operating systems, which often (but not always) use NetworkManager.

Find network devices

Use the command pciconf -lv | grep -A1 -B3 network to get a high-level overview of what your network devices are. Linux will often (again, not always) give these names like eth0, eth1, eth2, and so on, for ethernet. FreeBSD is more likely to use initials based on the vendor's name, like re0 would be RealTek and igb0 would be a 1 Gbps Intel card.

Like Linux and other UNIX-like operating systems, the ifconfig command should show you the running configuration.

DCHP client configuration

If you're an end user, this is likely the way you want to configure your FreeBSD host. In most cases, you only need one command to be up and running.

dhclient ix0 – use dhclient to connect using ix0

To make the connection persist and come up automatically at the next reboot, run:

sysrc ifconfig_ix0="DHCP" – adds the configuration to /etc/rc.conf

Basic static IP configuration

Much of the basic system configuration on a FreeBSD machine happens in /etc/rc.conf.

You will also want to add DNS servers to /etc/resolv.conf. Edit the file and add lines like:

nameserver 8.8.8.8 #primary Google public nameserver
nameserver 8.8.4.4 #secondary Google public nameserver

These might be Internet-provider assigned, or you can use various publicly available resolvers (1.1.1.1 is also popular).

Command Explanation
ifconfig ix0 inet 192.168.1.10/24 Set ix0 interface to use the IP address 192.168.1.10
sysrc ifconfig_ix0="inet 192.168.1.10 netmask 255.255.255.0" Set the above to persist accross reboots
sysrc defaultrouter="192.168.1.1" Set the default route in /etc/rc.conf to 192.168.1.1
service netif restart && service routing restart Reset network interfaces and routing process
Home | Services | Destinations | HelpWeb |Terms of Service | Acceptable Use | Contact Us | WebMail