dhcpcd-discuss

Re: DHCP inform in VPN tunnel

Maxim Loschilov

Mon Mar 12 10:28:59 2018

Hello Roy,

According to additional investigation, network interfaces are used
differently than it was expected. So seems that another dhcpcd config
is needed.

The following manipulations are made with the interfaces during VPN tunnel
setup:

1) When device boots up, there is one interface 'eth0'. On this interface
DHCP starts and gets IP address in the home network.

2) When VPN tunnel is then setup, 'eth0' is reconfigured to be used as VPN
interface
with IP address from private network provided by VPN Gateway.

Then DHCP INFORM is sent in the private network to get other network params.

And for common network a new interface 'eth0:0' is set up which is
configured with IP address that 'eth0' previously had.



So it seems that in terms of DHCP operations the following is needed:

1) When the phone boots up, to perform a standard DHCP DISCOVER/REQUEST
for 'eth0'.

2) After VPN tunnel is set up and private network IP address is assigned to
'eth0',
DHCP INFORM should be sent via this interface to the private network.
As IP address is static, seems that DCHP can be finished on this interface.

In the mean time when 'eth0:0' is created, need to take over current DHCP
lease
that was on 'eth0' and then to maintain it and renew when necessary for
the whole time when VPN tunnel exists.

How can this scenario may be implemented using 'dhcpcd'?

Thanks,
Maxim Loschilov


2018-02-12 17:42 GMT+03:00 Roy Marples <roy@xxxxxxxxxxxx>:

> 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 tunnelRoy Marples
References:
DHCP inform in VPN tunnelMaxim Loschilov
Re: DHCP inform in VPN tunnelRoy Marples
Archive administrator: postmaster@marples.name