Using a Static IP Address

In order for the rest of the networking sections to be mildly useful, you really want to set up a Static IP address. That way you won't have to keep changing it whenever someone wants to access one of these services. First of all you need to know a little bit of information. You need to know what IP Address your router has assigned to itself. In my case it is 192.168.1.1. Next find out what network device you are using by issuing ifconfig. You should see something and lo0. Use the something, which in my case is rl0. Now issue these two commands (with modifications of course):

ifconfig rl0 192.168.1.100 255.255.255.0
route add default 192.168.1.1

192.168.1.100 was my desired IP Address. Make sure the IP Address you choose isn't in the DHCP range for your router, but is still on the same subnet. Change that and your router's address as needed. Now try pinging something or doing anything online. If all goes well it will work successfully. If not try pinging your router. If that doesn't work reset your router and try again. I'll leave further troubleshooting up to you. Assuming all went well let's make it permanent. In /etc/resolv.conf add this line:

nameserver 192.168.1.1

Where you replace 192.168.1.1 with your router's IP Address. Next in /etc/rc.conf:

ifconfig_rl0="192.168.1.100 255.255.255.0"
defaultrouter="192.168.1.1"

However if you ever for some reason want to go back to DHCP in /etc/rc.conf delete those two lines and add this one:

ifconfig_rl0="DHCP"

Replacing rl0 as necessary of course.