Web www.freebsdmadeeasy.com
Main Menu

Setting up the Network

Configuring a network card

The simplest way to configure a network card is to use /stand/sysinstall

# /stand/sysinstall

In the FreeBSD config choose Configuration and then Packages. On the next menu choose FTP, then any of the sites. When asked "Assume that the network is already configured? Choose "no". Using DHCP is the easiest if you have DHCP, otherwise you will be prompted to enter the information. When you are done it will resume connecting the FTP and you will know right away if your settings work or not.

/stand/sysinstall is just a GUI for the configuration. When setting up the network within it, it merely writes a few lines to /etc/rc.conf You can edit rc.conf yourself. The normal DHCP setup for a network card looks like this


A static ip setup looks like this

ifconfig_xl0="inet netmask"

Within the rc.conf file there may be several different groups of these from configuring the network card, but only the last one in the file is used.

Multiple IPs on one network card

ifconfig_xl0="inet netmask"
ifconfig_xl0_alias0="inet netmask"
ifconfig_xl0_alias1="inet netmask"

Multiple network cards in one machine

Having multiple network cards in one machine is not a problem. Just configuring them both in rc.conf as you would normally, but with only one default router line. The hostname line for each needs to follow directly after the card is declared.

Multiple netword cards on different networks

Having multiple cards in one machine on the same network is a simple matter, but setting the cards to seperate networks is another matter. They are both setup normally as above with the ips declared statically, and the defaultrouter set to the network you want the machine to use for everything that isn't specifically set to go out on the other card.

To see what router is set to default use the command

# netstat -r

The first router on the list is the default router. Since FreeBSD sometimes changes the route if there is a problem it works best to create a start up script to set the route you want traffic to default to

route change default >> /dev/null
echo "DefRoute"

Getting this all to work can be tricky, and sometimes depends on the order the network cards are listed rc.conf, but it can be done, so don't give up!

Sending the hostname to the DHCP server

On many DSL modems and routers the hostname will not show up for FreeBSD machines when they are set to DHCP. To fix this you can add the following lines to /etc/dhclient.conf and replace the network card and hostname with your own

interface "xl0" {
     send host-name "plato";