dhcpcd-discuss

Re: DHCP inform in VPN tunnel

Roy Marples

Mon Feb 12 14:41:51 2018

Hi Maxim

On 12/02/2018 13:17, Maxim Loschilov wrote:
I need to implement connection of some device to private network via VPN
and then get network settings from private DHCP Server using DHCPINFORM.

The steps are the following:

1) Reboot the device and start 'dhcpcd' as a daemon to obtain and maintain DHCP lease
     in the public network.

2) Connect to the private network via VPN gateway.

3) In the private network use 'dhcpcd' and DHCPINFORM to obtain network settings
    of the private network.

    DHCPINFORM is used because IP address will be assigned by VPN gateway.



The main question is is it possible at all to implement this scenario using 'dhcpcd' ?

If yes, then there are subquestions:

 - How should I use 'dhcpcd' at step 3? Should I execute it as a separate command:

    system("dhcpcd --inform") ?

 - Will it run a separate daemon process for a single operation or pass this info
    to already running daemon?

 - Do I correctly understand that I should run ' dhcpcd ' on a virtual interface?


Because the VPN interface would be created when needed and destroyed when not, something needs to start/stop dhcpcd each time or dhcpcd needs to be configured to react to interface arrivals/departures.

The former requires knowledge of how your OS and/or VPN works.
The latter just required you to start dhcpcd in master mode - ie no interface specified on the command line.

Here's what you should do in dhcpcd.conf, replacing tap0 with the interface name of your VPN.

# Add this at the top to restrict dhcpcd to just tap0
allowinterfaces tap0

# Add this at the bottom
interface tap0
inform

>   - How should parameters, obtained from DHCPACK reply on DHCPINFORM
> request,
>     be processed - will separate options/reason files be created?

Just like any other DHCP request.
There's nothing special or extra you need to do here.

If there are any issues with this, let me know!
Good luck!

Roy

Follow-Ups:
Re: DHCP inform in VPN tunnelMaxim Loschilov
References:
DHCP inform in VPN tunnelMaxim Loschilov
Archive administrator: postmaster@marples.name