Using a learn-address script
This recipe will demonstrate how to set up a
learn-address script that is executed on the server side when there is a change in the address of a connecting client. Learn-address scripts can be used to dynamically set up firewalling rules for specific clients or to adjust routing tables.
In this recipe, we will use a
learn-address script to open up a firewall and to set up masquerading for a client. When the client disconnects, the firewall is closed again and the
iptables masquerading rule is removed.
Install OpenVPN 2.3 or higher on two computers. Make sure that the computers are connected over a network. Set up the client and server certificates using the first recipe from Chapter 2, Client-server IP-only ...