Starting with OpenVPN 2.4, it is now possible to filter out options pushed from the OpenVPN server to the client. This allows users to have more control over the network routes and addresses that are pushed from the server.
This recipe will show how this new feature of OpenVPN works.
We will use the following network layout:
Set up the client and server certificates using the first recipe from Chapter 2, Client-server IP-only Networks. For this recipe, the server computer was running CentOS 6 Linux and OpenVPN 2.3.12. The client was running Windows 7 64 bit and OpenVPN 2.4_alpha2. For the server, keep the configuration file, example9-2-server.conf
, from the Linux - using pull-resolv-conf recipe, from Chapter 9, OS Integration at hand. For the client, keep the configuration file, basic-udp-client.ovpn
, from the Using an ifconfig-pool block recipe from Chapter 2, Client-server IP-only Networks.
[root@server]# openvpn --config example9-2-server.conf
basic-udp-client.ovpn
, and save it as example10-11.ovpn
:pull-filter ignore "dhcp-option DNS"
View Log
in the OpenVPN GUI. The log file will contain lines similar to the following:PUSH: Received control message: 'PUSH_REPLY,dhcp-option DNS 192.168.3.1,route-gateway 10.200.0.1,topology subnet,ping 10,ping-restart 60,ifconfig 10.200.0.2 255.255.255.0' Pushed option removed by filter: 'dhcp-option DNS 192.168.3.1'
ipconfig /all
.The pull-filter
directive accepts several parameters:
accept t
: Accepts the pushed option t
from the serverignore t
: Ignores the pushed option t
from the server, but doesn't abort the connectionreject t
: Rejects the pushed option t
from the server and abort the VPN connectionEach option can be specified multiple times, with the last occurrence overriding earlier lines.
By adding the line pull-filter ignore "dhcp-option DNS"
to the client configuration file, we ignore any pushed line that starts with dhcp-option DNS
. Therefore, no DNS settings are accepted from the VPN server. This option can be applied to all options that are pushed from the server.
3.141.7.186