Re: DHCP server that itself gets an IP address by DHCP
Hi.
On Fri, 25 Aug 2017 07:28:00 +0900
Mark Fletcher <mark27q1@gmail.com> wrote:
> On Thu, Aug 24, 2017 at 11:35:25PM +0300, Reco wrote:
> > On Thu, 24 Aug 2017 22:21:04 +0200
> > Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:
> >
> > > Le 24/08/2017 à 11:30, Reco a écrit :
> > > >
> > > > Somewhat hackish, but straightforward way to achieve this is to redirect
> > > > DNS requests from your LAN to correct DNS. Something like this should do
> > > > the trick:
> > >
> > > Not so straightforward because you still need to get the ISP's DNS and
> > > update the iptables rules whenever the DNS change.
> >
> > Appropriate dhclient hook should do this trick.
> > I'd start with copying and modifying resolvconf one.
> >
> I think the concept of "appropriate dhclient hook" might be exactly what
> I was after -- could an "appropriate dhclient hook" perhaps be used to
> update the name servers being offered by the DHCP server?
Sure it can. What you need is to
copy /etc/dhcp/dhclient-enter-hooks.d/resolvconf under a different name
and make changes in make_resolv_conf shell function.
> And would that
> be done by updating dhcp.conf and restarting the dhcp server, or would
> that cause other problems?
I don't see why it should. I still prefer iptables approach as that way
you whole internal network will get new DNS immediately and not after
the Airstation decide to renew DHCP lease.
> And, is dhclient a separate piece of software from systemd.networkd?
I was referring to a reference implementation - isc-dhcp-client.
I honestly do not know if systemd-networkd utilizes these hooks.
> Because I am using the latter at the moment to get the IP address from
> the ISP on the firewall machine, although I am not married to that
> method, it's just that it was super-easy to set up and worked first
> time, so I never had reason to look for an alternative.
Utilizing any other DHCP client is as simple as adding two lines
in /etc/network/interfaces:
auto <WAN interface>
inet <WAN interface> inet dhcp
Reco
Reply to: