Tuesday, 16 September 2014

Can't allocate interface tap0lease { interface .

Out of the blue my DHCP client started to refuse to obtain an address over openvpn :(

$ sudo dhclient -v -r -w tap0
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Can't allocate interface tap0lease {
  interface .

After some googling I finally figured out how to fix it.
I had to delete the "tap0lease" line from /var/lib/dhcp/dhclient.leases :

==
...
lease {
  interface "tap0lease {
  interface "tap0";
  fixed-address 192.168.100.153;
  option subnet-mask 255.255.255.0;
...
==

It probably broke on a recent upgrade (I'm running Ubuntu 14.04 Trusty):