MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat
14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Oct Nov Dec

Mon, Aug 08, 2016 10:09 pm

Using dhclient to locate DHCP Servers on a LAN

On a Linux system, you can use the dhclient command to identify any Dynamic Host Configuration Protocol (DHCP) servers that are available on the local area network (LAN). First, you need to determine a relevant network interface on the system over which an IP address might be acquired via DHCP. You can do so using the ip command. If the -f inet option is given to the command, it will show only IPv4 addresses.

# ip -f inet address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    inet scope host lo
       valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet brd scope global dynamic enp4s0
       valid_lft 156092sec preferred_lft 156092sec
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    inet brd scope global virbr0
       valid_lft forever preferred_lft forever

Alteratively, you can use the ifconfig command with the -a option to show all network interfaces and any assigned IP addresses for them. I.e., ifconfig -a.

In the example above from a CentOS 7 system, I can see that an IP address is assigned to the enp4s0 network interface and that is the interface I will use for the DHCP query to locate any DHCP servers on the network, which may be legitimate or rogue DNS servers.

To have the dhclient command search for DHCP servers, I'll use the -d and -nw options.

[ More Info ]

[/network/dhcp] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo