The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
How to build a gateway 5 July 1999
Need more help on this topic? Click here
This article has no comments
Show me similar articles
This article shows you where to get some of the information needed in order to build a gateway.  This will allow your computers to share a single connection to your ISP.

I've just thrown this article together from other documents I've written.  It should work.  But if it doesn't, please add your comments and give me a hard time about it.  Please remember to point out the problem you had.

A gateway allows one computer to talk to an outside network and channel requests from other computers.  If you have more than one computer, it makes sense to have one of them act as the gateway to your ISP.  It allows all of your computers to share a single modem.  It's easy and it's cheap.

I will assume that you are using a dial-up connection.  But if you have a cable modem or ADSL, don't worry, this is pretty much the same for you too.

Install FreeBSD
The first thing you should do is install FreeBSD.  There are several guides:
Installing FreeBSD on a Windows 95 machine
Installing FreeBSD to replace Windows 95

So, let's continue and assume you have 3.2-Release (or similar) installed.

Making it a gateway
To make a FreeBSD box into a gateway, you need to add this to /etc/rc.conf:
gateway_enable="YES" # Set to YES if this host will be a gateway.
Enabling PPP
To get PPP going, you should see:


Aliasing or NAT
Because you are using PPP, you'll want to add the alias option in order to translate the private addresses to public addresses.


If you are using a cable modem or ADSL, you'll want to perform NAT.  See:


Configure the clients
The next step is to make the other machines on the network talk to the gateway.   This is done by adding the following line to /etc/rc.conf:

You should replace with the actual IP address of your gateway.  NOTE: you want the IP address given to your network card, which is not necessarily the one given to you by your ISP.  It might be something like or

After making the above change, you should reboot.

For Windows, look under Control Panel->Networks->Protocols->TCP/IP->Default Gateway.

Need more help on this topic? Click here
This article has no comments
Show me similar articles