Virtual Private Networks and IPsec with FreeBSD

Nik Clayton

nik@FreeBSD.org

Hiten M. Pandya

hmp@FreeBSD.org

May 20, 2003

There is not much documentation as to what constitutes a Virtual Private Network (VPN). VPNs can be implemented using a number of different technologies, each having their own strengths and weaknesses. This article presents a number of scenarios, and strategies for implementing a VPN for each scenario.



1 Two Networks on the Internet as One

This scenario has the following premise:

The network topology for this scenario will look similar to the ASCII diagram below:

      Network #1    [ Internal Hosts ]    Private Net, 192.168.1.2-254
                    [   Win9x/NT/2K  ]
                    [      UNIX      ]
                             |
                             |
                       .---[fxp1]---.        Private IP, 192.168.1.1
                       |   FreeBSD  |
                       `---[fxp0]---'        Public IP, A.B.C.D
                             |
                             |
                    -=-=- Internet -=-=-
                             |
                             |
                       .---[fxp0]---.        Public IP, W.X.Y.Z
                       |   FreeBSD  |
                       `---[fxp1]---'        Private IP, 192.168.2.1
                             |
                             |
      Network #2    [ Internal Hosts ]
                    [   Win9x/NT/2K  ]    Private Net, 192.168.2.2-254
                    [      UNIX      ]
   

Notice the two public IP addresses. Letters have been used to refer to them in the rest of this article; that combination of letters should be replaced with your real public IP addresses. It should also be noted, that both gateways have distinct private IP addresses (192.1681.x and 192.168.2.x, respectively). All the machines in the private networks have been configured to use the gateway. From a network point of view, each network should view the machines on the other network as though they were directly attached to the same same router -- albeit a slightly slow router with an occasional tendency to drop packets. This means (for example), machine 192.168.1.20 should be able to run:

      % ping 192.168.2.34
   

and have it function transparently. Microsoft Windows machines should be able to see the machines on the other network, browse file shares, etc; in exactly the same manner that they can broswe machines on the local network. All of this has to be secure, thus the traffic has to be encrypted.

Creating a VPN between these two networks is a multi step process. The stages are as follows:


This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.