Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Firstly, parsing configuration files isn't really correct. And not nearly distro-independent either.

My first idea was to search for running dhclient processes, but each distribution uses a different esoteric command line. Even the binary name itself varies. In Fedora, it's dhclient. In Ubuntu, it's dhclient3.

Is there something in /proc or /sys that indicates that an IP is dynamic?

share|improve this question
1  
Why exactly do you need this? What exactly are you trying to accomplish? –  Juliano Sep 10 '09 at 19:21
1  
Have you grepped around in /var/lib/dhcp*/dh*lease* ? –  Dennis Williamson Sep 10 '09 at 19:43
    
@Dennis: That looks good. I'm using it. –  JCCyC Sep 10 '09 at 21:35
    
@Juliano: remote system info gathering. –  JCCyC Sep 10 '09 at 21:35
    
@Dennis: Make it into an answer so I can accept it. –  JCCyC Sep 10 '09 at 21:55
show 3 more comments

2 Answers

up vote 4 down vote accepted

Have you grepped around in /var/lib/dhcp*/dh*lease* ?

On my Ubuntu system, as an example, /var/lib/dhcp3/dhclient-eth0.lease contains information about the current and recent leases.

share|improve this answer
    
-1 because it is dhclient-specific and there are other DHCP clients. –  bortzmeyer Sep 14 '09 at 8:30
    
The OP specified dhclient and dhclient3 in the question. –  Dennis Williamson Sep 14 '09 at 13:34
    
So, how do pump and others store the leases? –  JCCyC Sep 16 '09 at 21:07
add comment

Check the DHCP server for a lease that matches the MAC address of the network card

share|improve this answer
    
... using dhcping utility. –  hayalci Sep 10 '09 at 21:00
    
I only have access to the client machine. –  JCCyC Sep 10 '09 at 21:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.