Configure the network
Check the connection
The basic installation procedure typically has a function network configuration. Use
ping to check the connection:
$ ping www.google.com
PING www.l.google.com (184.108.40.206) 56(84) bytes of data. 64 bytes from wb-in-f105.1e100.net (220.127.116.11): icmp_req=1 ttl=50 time=17.0 ms ...
If the ping is successful (you see 64 bytes messages as above), then the network is configured. Press
Control-C to stop the ping.
If the ping failed with an Unknown hosts error, it means that your machine was unable to resolve this domain name. It may be related to your service provider or your router/gateway. Try pinging a static IP address to prove that your machine has access to the Internet:
$ ping 18.104.22.168
PING 22.214.171.124 (126.96.36.199) 56(84) bytes of data. 64 bytes from 188.8.131.52: icmp_req=1 ttl=53 time=52.9 ms ...
If you are able to ping
184.108.40.206 but not
www.google.com, check your DNS configuration. See resolv.conf for details. The
hosts line in
/etc/nsswitch.conf is another place you can check.
If not, check for cable issues before diagnosing further.
Set the hostname
A hostname is a unique name created to identify a machine on a network.
Set hostname with freebsd-init
To set the system's hostname while using freebsd-init run
Set hostname with OpenRC
To set the systems's hostname while using OpenRC run
echo 'HOSTNAME="hostname"' > /etc/conf.d/hostname
Configure the Network Interface
Check the status
First, determine the model of the NIC and the chip it uses. PacBSD supports the same NICs that FreeBSD does, check FreeBSD's Hardware Compatibility list to see if the NIC is supported.
An easy way to see the model of the NIC is by running
# lspci -v
03:0e.0 Ethernet controller: Intel Corporation 82545GM Gigabit Ethernet Controller (rev 04) Subsystem: Dell Device 0173 Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 48 Memory at dfee0000 (64-bit, non-prefetchable) I/O ports at dcc0 Capabilities: [dc] Power Management version 2 Capabilities: [e4] PCI-X non-bridge device Capabilities: [f0] MSI: Enable- Count=1/1 Maskable- 64bit+
If the NIC is supported, determine the name of the driver for the NIC. The drivers for common NICs are already present in the GENERIC kernel, meaning the NIC should be probed during boot. The system's boot messages can be viewed with
less /var/log/dmesg and using the spacebar to scroll through the text. An easy way to see which driver is loaded, copy the memory address from the
lspci and use a tool like
grep to search the file.
$ grep dfee0000 /var/log/dmesg
em0: <Intel(R) PRO/1000 Legacy Network Connection 1.1.0> port 0xdcc0-0xdcff mem 0xdfee0000-0xdfefffff irq 48 at device 14.0 on pci3
In this example we can see that the em(4) driver is loaded for this NIC.
Another way to work out the driver for the NIC is with
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC> ether 00:11:43:15:b1:a1 inet6 fe80::211:43ff:fe15:b1a1%em0 prefixlen 64 scopeid 0x1 inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255 nd6 options=1<PERFORMNUD> media: Ethernet autoselect (1000baseT <full-duplex>) status: active lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> groups: lo
If for some reason the NIC in question is supported, but the driver isn't automatically loaded, this can be done with kldload(8). This can be done as a one time thing, running in a terminal as root, or added to /boot/loader.conf so it will be loaded at boot automatically:
To have the system configure the interface with DHCP on boot, add the following line to
This will run the DHCP client in the background allowing the rest of the boot process to continue while waiting for a response from the DHCP server. Because this runs asynchronously (not blocking) this could cause other services that require network, such as mounting a network share, to fail. If this happens the DHCP client can be set to run synchronously (blocking), this way the boot process will pause while waiting for a response from the DHCP server. To set this add the following line to
By default OpenRC is configured to use DHCP by default, to get it to work an init script for the network interface needs to be created due to the way PacBSD names its interfaces. The easiest way to do this is by copying, or symlinking,
# ln -s /etc/init.d/net.lo0 /etc/init.d/net.em0
Then tell OpenRC to start this at boot, and start it immediately with:
# rc-update add net.em0 default # rc-service net.em0 start