Re: [Dnsmasq-discuss] DNS set using dhcp-host expires?

2020-04-22 Thread Jiawen Chen
Hey - that worked! Setting my leases to 12 hrs fixed everything. Heh, I
guess there are some subtleties in interpreting "infinite".

For completeness:

# Old. not working.
# dhcp-host=,192.168.0.150,livingr
oom.internal,infinite

# New, working.
# Diff:
# - 12 hour lease, not infinite
# - Don't even need the .internal suffix
# Removed hosts file
dhcp-host=,192.168.0.150,[::0:1000],livingr
oom,12h

On Tue, Apr 21, 2020 at 1:54 PM Geert Stappers  wrote:

> On Tue, Apr 21, 2020 at 09:57:34AM -0400, Jiawen Chen wrote:
> > On Tue, Apr 21, 2020 at 3:06 AM Geert Stappers wrote:
> > > On Mon, Apr 20, 2020 at 10:27:11PM -0400, Jiawen Chen wrote:
> > > >
> > > > I'm using dnsmasq for DHCP + DNS on my home LAN and use dhcp-host to
> > > > statically assign an IP address and hostname. However, I'm
> discovering that
> > > > while it works most of the time, sometimes, ssh for example, can't
> find the
> > > > host by name, only IP. One instance is a Linux VM. Initially I can
> ssh into
> > > > the VM. But if I power down the VM for say a few days, and start it
> back
> > > > up, the name is missing (even though it is somehow assigned the same
> IP (it
> > > > keeps its MAC)).
> > > >
> > > > dnsmasq.conf:
> > > > ```
> > > > # other irrelevant stuff
> > > >  ...
> > > > # Assign 192.168.0.150 to my living room pc
> > > >
> dhcp-host=,192.168.0.150,livingroom.internal,infinite
> > > >
> > > > # Assign 192.168.0.151 to my file server
> > > >
> dhcp-host=,192.168.0.151,fileserver.internal,infinite
> > > > ```
> > >
> > > I suggest to change  the   ',infinite'   into something like  ',12h'
> for
> > > the servers that are be powered-off of for several days.
> > >
> > > What I think is that the DNS cache  entry expires
> > > ( and I think that it is valid behaviour.)
> > >
> > >
> > > Expriment that can be done:
> > >
> > >  * Restart dnsmasq,  so it forgets about dhcp-hosts in DNS cache
> > >  * Check cache dump with  SIGUSR1
> > >  * Power-on an infinite DHCP client e.g. the Linux VM
> > >  * Check cache dump with SIGUSR1
> > >  * Regular work with the example Linux VM
> > >  * Power-off the infinite DHCP client
> > >  * Sample several days the cache dump
> > >  * Report when the DNS entry of the powered-off server is gone
> > >
> >
> > Thanks! That makes sense. I will give that a shot.
>
>
> Cool.  I look forward on feedback.
>
>
>
> Groeten
> Geert Stappers
> --
> Silence is hard to parse
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] DNS set using dhcp-host expires?

2020-04-21 Thread Geert Stappers
On Tue, Apr 21, 2020 at 09:57:34AM -0400, Jiawen Chen wrote:
> On Tue, Apr 21, 2020 at 3:06 AM Geert Stappers wrote:
> > On Mon, Apr 20, 2020 at 10:27:11PM -0400, Jiawen Chen wrote:
> > >
> > > I'm using dnsmasq for DHCP + DNS on my home LAN and use dhcp-host to
> > > statically assign an IP address and hostname. However, I'm discovering 
> > > that
> > > while it works most of the time, sometimes, ssh for example, can't find 
> > > the
> > > host by name, only IP. One instance is a Linux VM. Initially I can ssh 
> > > into
> > > the VM. But if I power down the VM for say a few days, and start it back
> > > up, the name is missing (even though it is somehow assigned the same IP 
> > > (it
> > > keeps its MAC)).
> > >
> > > dnsmasq.conf:
> > > ```
> > > # other irrelevant stuff
> > >  ...
> > > # Assign 192.168.0.150 to my living room pc
> > > dhcp-host=,192.168.0.150,livingroom.internal,infinite
> > >
> > > # Assign 192.168.0.151 to my file server
> > > dhcp-host=,192.168.0.151,fileserver.internal,infinite
> > > ```
> >
> > I suggest to change  the   ',infinite'   into something like  ',12h' for
> > the servers that are be powered-off of for several days.
> >
> > What I think is that the DNS cache  entry expires
> > ( and I think that it is valid behaviour.)
> >
> >
> > Expriment that can be done:
> >
> >  * Restart dnsmasq,  so it forgets about dhcp-hosts in DNS cache
> >  * Check cache dump with  SIGUSR1
> >  * Power-on an infinite DHCP client e.g. the Linux VM
> >  * Check cache dump with SIGUSR1
> >  * Regular work with the example Linux VM
> >  * Power-off the infinite DHCP client
> >  * Sample several days the cache dump
> >  * Report when the DNS entry of the powered-off server is gone
> >
> 
> Thanks! That makes sense. I will give that a shot.


Cool.  I look forward on feedback.



Groeten
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] DNS set using dhcp-host expires?

2020-04-21 Thread Jiawen Chen
Thanks! That makes sense. I will give that a shot.

On Tue, Apr 21, 2020 at 3:06 AM Geert Stappers  wrote:

> On Mon, Apr 20, 2020 at 10:27:11PM -0400, Jiawen Chen wrote:
> > Hi,
> >
> ...
> >
> > I'm using dnsmasq for DHCP + DNS on my home LAN and use dhcp-host to
> > statically assign an IP address and hostname. However, I'm discovering
> that
> > while it works most of the time, sometimes, ssh for example, can't find
> the
> > host by name, only IP. One instance is a Linux VM. Initially I can ssh
> into
> > the VM. But if I power down the VM for say a few days, and start it back
> > up, the name is missing (even though it is somehow assigned the same IP
> (it
> > keeps its MAC)).
> >
> > dnsmasq.conf:
> > ```
> > # other irrelevant stuff
> >
> > no-resolv
> > server=8.8.8.8
> > server=8.8.4.4
> > server=1.1.1.1
> >
> > expand-hosts
> > domain-needed
> > bogus-priv
> > local=/internal/
> >
> > # Assign 192.168.0.150 to my living room pc
> >
> dhcp-host=,192.168.0.150,livingroom.internal,infinite
> >
> > # Assign 192.168.0.151 to my file server
> >
> dhcp-host=,192.168.0.151,fileserver.internal,infinite
> > ```
>
> I suggest to change  the   ',infinite'   into something like  ',12h' for
> the servers that are be powered-off of for several days.
>
> What I think is that the DNS cache  entry expires ( and I think that it
> is valid behaviour.)
>
> Expriment that can be done:
>
>  * Restart dnsmasq,  so it forgets about dhcp-hosts in DNS cache
>  * Check cache dump with  SIGUSR1
>  * Power-on an infinite DHCP client e.g. the Linux VM
>  * Check cache dump with SIGUSR1
>  * Regular work with the example Linux VM
>  * Power-off the infinite DHCP client
>  * Sample several days the cache dump
>  * Report when the DNS entry of the powered-off server is gone
>
>
> Recipe to sabotage the expriment:
>   while true
>   do
>  nslookup  linuxVM  >   output
>  process_output
>  if  hostname_not_found
>  then
> exit
>  fi
>  sleep 2 hour
>   done
>
> because it keeps the DNS entry in cache.
>
>
> >
> > For these static DHCP leases, is the best practice to set them in
> > /etc/hosts instead?
> >
> > I also discovered --host-record, which does something very similar. Is
> > there an advantage in using one option vs the other?
> >
>
>
> Groeten
> Geert Stappers
> --
> Silence is hard to parse
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] DNS set using dhcp-host expires?

2020-04-20 Thread Geert Stappers
On Mon, Apr 20, 2020 at 10:27:11PM -0400, Jiawen Chen wrote:
> Hi,
> 
...
> 
> I'm using dnsmasq for DHCP + DNS on my home LAN and use dhcp-host to
> statically assign an IP address and hostname. However, I'm discovering that
> while it works most of the time, sometimes, ssh for example, can't find the
> host by name, only IP. One instance is a Linux VM. Initially I can ssh into
> the VM. But if I power down the VM for say a few days, and start it back
> up, the name is missing (even though it is somehow assigned the same IP (it
> keeps its MAC)).
> 
> dnsmasq.conf:
> ```
> # other irrelevant stuff
> 
> no-resolv
> server=8.8.8.8
> server=8.8.4.4
> server=1.1.1.1
> 
> expand-hosts
> domain-needed
> bogus-priv
> local=/internal/
> 
> # Assign 192.168.0.150 to my living room pc
> dhcp-host=,192.168.0.150,livingroom.internal,infinite
> 
> # Assign 192.168.0.151 to my file server
> dhcp-host=,192.168.0.151,fileserver.internal,infinite
> ```

I suggest to change  the   ',infinite'   into something like  ',12h' for
the servers that are be powered-off of for several days.

What I think is that the DNS cache  entry expires ( and I think that it
is valid behaviour.)

Expriment that can be done:

 * Restart dnsmasq,  so it forgets about dhcp-hosts in DNS cache
 * Check cache dump with  SIGUSR1
 * Power-on an infinite DHCP client e.g. the Linux VM
 * Check cache dump with SIGUSR1
 * Regular work with the example Linux VM
 * Power-off the infinite DHCP client
 * Sample several days the cache dump
 * Report when the DNS entry of the powered-off server is gone


Recipe to sabotage the expriment:
  while true
  do
 nslookup  linuxVM  >   output
 process_output
 if  hostname_not_found
 then
exit
 fi
 sleep 2 hour
  done

because it keeps the DNS entry in cache.


> 
> For these static DHCP leases, is the best practice to set them in
> /etc/hosts instead?
> 
> I also discovered --host-record, which does something very similar. Is
> there an advantage in using one option vs the other?
> 


Groeten
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss