Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

2.3. So how does it work?

Put simply, to make a VPN, you create a secure tunnel between the two networks and route IP through it. If I've lost you already, you should read The Linux Networking Overview HOWTO to learn more about networking with Linux.

Here are some diagrams to illustrate this concept:


                                \          \
   Remote ______| Client |______\ Internet \_____| Server |______ Private
   Network      | Router |      /          /     | Router |       Network
                                /          /

                         Client Router
              |   /->   \                    |
  Remote      |  |-->  |--> Tunnel >---\   |
  Network >---|--|--> /                 |--|----> Internet |  |                                              |  |
              |   \-----> --> IP Masquerade >--/   |

                        Server Router
            |                   /->    \   |
            |   /--> Tunnel >--|-->   |--|----> Private
Internet >--|--|                \--> /   |      Network
            |  |                                                 |
            |   \-----> -----> /dev/null         |

The above diagram shows how the network might be set up. If you don't know what IP Masquerading is, you should probably read the The Linux Networking Overview HOWTO and come back once you understand how it works.

The Client Router is a Linux box acting as the gateway/firewall for the remote network. The remote network uses the local IP address For the sake of a simple diagram, I left out the local routing information on the routers. The basic idea is to route traffic for all of the private networks (,, and through the tunnel. The setup shown here is one way. That is, while the remote network can see the private network, the private network cannot necessarily see the remote network. In order for that to happen, you must specify that the routes are bidirectional.

From the diagram you should also note that all of the traffic coming out of the client router appears to be from the client router, that is, all from one IP address. You could route real numbers from inside your network but that brings all sorts of security problems with it.