Skip to main content
Improve description and mark directory.
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 267

Assume eth0 is DHCP client interface.
One of optionsoption is to check the DHCP client lease files dhcpd.leases
Place and name dependdepends on system,the system; on some fedora boxFedora systems, the files under /var/lib/dhclient/ areare lease files, where the interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on a funtoo box: dhcpcd -U eth0dhcpcd -U eth0
prints a nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There also anotherother options like dhcpingdhcping, dhclient -ndhclient -n, according to google and manpages, but they failsfail on my boxes, but may work for you.

Assume eth0 is DHCP client interface.
One of options is to check DHCP client lease files dhcpd.leases
Place and name depend on system, some fedora box under /var/lib/dhclient/ are lease files, where interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on funtoo box: dhcpcd -U eth0
prints nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There also another options like dhcping, dhclient -n according google and manpages, but they fails on my boxes, but may work for you.

Assume eth0 is DHCP client interface.
One option is to check the DHCP client lease files dhcpd.leases
Place and name depends on the system; on some Fedora systems, the files under /var/lib/dhclient/ are lease files, where the interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on a funtoo box: dhcpcd -U eth0
prints a nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There other options like dhcping, dhclient -n, according to google and manpages, but they fail on my boxes, but may work for you.

Assume eth0eth0 is dhcpDHCP client interface.
One of options is to check dhcpDHCP client lease files dhcpd.leases
Place and name depend on system, some fedora box under /var/lib/dhclient//var/lib/dhclient/ are lease files, where interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on funtoo box: dhcpcd -U eth0
prints nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There also another options like dhcping, dhclient -n according google and manpages, but they fails on my boxes, but may work for you.

Assume eth0 is dhcp client interface.
One of options is to check dhcp client lease files dhcpd.leases
Place and name depend on system, some fedora box under /var/lib/dhclient/ are lease files, where interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on funtoo box: dhcpcd -U eth0
prints nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There also another options like dhcping, dhclient -n according google and manpages, but they fails on my boxes, but may work for you.

Assume eth0 is DHCP client interface.
One of options is to check DHCP client lease files dhcpd.leases
Place and name depend on system, some fedora box under /var/lib/dhclient/ are lease files, where interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on funtoo box: dhcpcd -U eth0
prints nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There also another options like dhcping, dhclient -n according google and manpages, but they fails on my boxes, but may work for you.

Source Link
MolbOrg
  • 720
  • 7
  • 12

Assume eth0 is dhcp client interface.
One of options is to check dhcp client lease files dhcpd.leases
Place and name depend on system, some fedora box under /var/lib/dhclient/ are lease files, where interesting string is like that :

  option routers 192.168.1.1;

Another option, which worked for me on funtoo box: dhcpcd -U eth0
prints nice table, ready to source in scripts

broadcast_address=192.168.1.255
dhcp_lease_time=86400
dhcp_message_type=5
dhcp_server_identifier=192.168.1.1
domain_name_servers='192.168.1.1 192.168.1.101'
ip_address=192.168.1.101
network_number=192.168.1.0
routers=192.168.1.1
subnet_cidr=24
subnet_mask=255.255.255.0

There also another options like dhcping, dhclient -n according google and manpages, but they fails on my boxes, but may work for you.