6

I'm running OpenVPN on a CentOS 7 server. The DHCP server on the LAN uses Option 121 to tell other devices to use this CentOS server if they want to get to the VPN subnets the OpenVPN server is connected to. This works great.

The problem is that this CentOS server is getting these same routes from the DHCP server, which breaks things. If I manually remove these static routes from its routing table, everything works.

Is there a way to have CentOS 7's DHCP client ignore these Option 121 routes from the DHCP server?

Right now, my solution is to add this to /etc/dhcp/dhclient-up-hooks:

#!/bin/bash

if [[ "$interface" == "ethX" ]]
then
    echo -e "\nRemoving extra routes"
    ip route delete 192.168.a.0/24 via 192.168.x.y
    ip route delete 192.168.b.0/24 via 192.168.x.y
fi

This works, but seems a little unclean, as the system will add the DHCP routes when the interface is starting up, and then remove them shortly after. Is there no way to tell the DHCP client to not add them in the first place?

PS. Yes, I can use a static IP on the OpenVPN server instead, which would solve my problem, but I prefer dhcp reservations.

0

You must log in to answer this question.

Browse other questions tagged .