PC-BSD Quick Guide


Internet Connection Sharing (NAT)

If you have more than one computer and if you use PC-BSD to connect to the Internet, you can share this connection with the rest of your network. You are using your PC-BSD machine as a "gateway". To do so, you need a fixed IP address for your network interface. If you don't yet, please have a look at the Network configuration to do so.

Setting up your computers

Now, on your PC-BSD computer, open your terminal and type the following command:

$ kdesu kwrite /etc/rc.conf 

Hit "Enter". It will ask your root password, type it and hit "Enter" one more time. The kwrite editor will open the rc.conf file for you. In this configuration file, add the following line:

gateway_enable="YES"

Save your file and exit the text editor. Restart PC-BSD, it should act as a gateway for other computers. To complete this process, for each other computer, open the configuration of network interfaces. In the "Gateway" field, type the IP address of your PC-BSD gateway, add also DNS entries. Now let's see if everything works.

Testing your environment

We are going to do three tests:

  1. Access the gateway using the following command: ping -c 3 gateway_ip_address_here
  2. Access the Internet without DNS using the following command: ping -c 3 4.2.2.2
  3. Access the Internet using the following command: ping -c 3 google.com

From your PC-BSD gateway, try test #1 to make sure you know the IP address of your gateway. The output on your terminal shouldn't give any error message:

%ping -c 3 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: icmp_seq=0 ttl=246 time=0.041 ms
64 bytes from 192.168.0.1: icmp_seq=1 ttl=246 time=0.041 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=246 time=0.041 ms

--- 192.168.0.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss

If you get an error message, this is because your didn't set your fixed IP address properly. If so, please have a look at Network configuration to set a fixed IP address for your network interface.

Now, do test #2. If the test fails, make sure you are connected to the Internet. It really should work if your connection is up. Do test #3 which should work as well. If it doesn't, but if test #2 does, then you have a DNS issue. Please make sure your DNS are properly configured on your network interface. The Network configuration chapter will assist you doing so.

Now, for each other computer of your network, let's try the following: Do test #1. If it fails, make sure the computer and the gateway are properly connected. Then, try test #2. If it fails, make sure your gateway is properly configured to act as a gateway, as detailed above. And eventually, try test #3. If it fails, you have a DNS misconfiguration on your computer. Make sure its DNS configuration is the same as the gateway's.

Once all these tests succeed, your other computers can access the Internet using your PC-BSD machine. Now, let's configure your firewall.


Index