admin:network:dhcp

DHCP

The domain-name option specifies the domain name that client should use when resolving hostnames via the Domain Name System. This is used for example in organizations where there are many workstations and in order to identify them easily their hostnames have appended the domain name like client1.example.org, client2.example.org, server1.example.org and so on.

The domain-name-servers option specifies a list of Domain Name System (STD 13, RFC 1035) name servers available to the client. Servers should be listed in order of preference. This option is pushed by the DHCP server to clients to allow them to query the local DNS servers when they access the Internet.

A DHCP server can push a lot more options than an IP address + subnet mask and gateway. You can check the man page to see all available DHCP options: http://linux.die.net/man/5/dhcp-options

Servers: DNSMasq

If you want to find out information about the lease on an interface, just cat /var/lib/dhcp/dhclient.<interfacename>.leases. There you'll find something like this:

lease {
  interface "enp1s0f1.83";
  fixed-address 10.11.12.110;
  option subnet-mask 255.255.252.0;
  option routers 10.11.12.1;
  option dhcp-lease-time 5400;
  option dhcp-message-type 5;
  option domain-name-servers 1.1.1.1,9.9.9.9;
  option dhcp-server-identifier 10.12.1.159;
  option pcode "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00";
  option dhcp-renewal-time 2700;
  option ntp-servers 1.2.3.4,5.6.7.8;
  renew 0 2022/07/10 10:41:08;
  rebind 0 2022/07/10 11:15:59;
  expire 0 2022/07/10 11:27:14;
}

The "routers" option shows you which routers you can enter as a nexthop in your own routing table.

systemd-networkd should store the lease info under /run/systemd/netif/leases/.

  • Last modified: 2024-07-05 14:31