Dhcp in use or not on Solaris machine

Hi All,

Could you please let me know how can we check whether any given solaris machien is using DHCP or not.
is

ps -ef | grep dhcp 

is full proof method or is their any other way.

You are looking for a DHCP process (a DHCP server), which has nothing to do with whether an interface is using DHCP.

Please search the forums first:

How to tell if i am using DHCP or Static | Unix Linux Forums | UNIX for Dummies Questions & Answers

thanks Scott. for soalris i am using the below script :

for i in `/usr/sbin/ifconfig -a | awk '/flags/ {print $1}' | grep -v lo | sed 's/://g'`
do
ifconfig $i dhcp status
done

which will give output as below :

 
ifconfig: e1000g0: interface is not under DHCP control
ifconfig: e1000g1: interface is not under DHCP control

simillarly for linux , is there any command(simillar to ifconfig <network adapter> dhcp status)
which can give status of DHCP.

It might depend on which Linux you are using. In RHEL, ifconfig is deprecated (and doesn't show if the interface is using DHCP, and it's replacement commands don't show it either, from what I can see).

You can check /var/lib/dhclient/dhclient-.leases files or the interface configuration files (in the case of RHEL) in /etc/sysconfig/network-scripts/ifcfg-.

thanks a lot Scott.

but is it possible by any other method apart from checking the file given by you.
i am just trying to check whether the RHEL machine is running with dhcp or not .
Please suggest.

DHCP clients are programs, not a driver or setting, which is why this is complicated. There isn't a special "this interface is using DHCP" flag. The client might not even still be running, and if it is, you don't necessarily know which client.

So, figuring out if a distribution uses DHCP comes down to understanding how it's configured and therefore knowing what to check for.

We have one address range for statis IP addresses. And we have a second range for DHCP addresses. I just look at the IP address and see which range it is in. Don't you guys have a specific range of addresses for DHCP?

thanks Corona688 for providing infomrtaion about DHCP as i know very little about it...As per your experience and knowledge could you please let me know what all files or things i should look for in order to check whether particular unix machine is using dhcp.

Corona688 .. no we do not have any specific range defined for dhcp..It would be really very helpfull if you can provide me any other way of checking whether dhcp is in use or not...thanks :slight_smile:

The configuration files a particular distribution uses.

DHCP operates somewhat below that layer. It has to -- the computer doesn't have an IP address yet. Try checking for 'bootpc' in 'netstat -an', though.

Again, this is not foolproof. Some DHCP clients will run once then quit. This method won't detect these. And I'm not sure netstat will work for dhcp clients, rather than servers.

no we do not have specific range of ips for Dhsp...could you please suggest some method to check the dhcp status.

The configuration file the distribution uses?