LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2006, 03:23 AM   #1
bit7
Member
 
Registered: Dec 2002
Location: Trieste, Italy
Distribution: salckware 8.0
Posts: 49

Rep: Reputation: 15
Smile Linux, dchp enabled info, dhcp server available


Hi all,

i'm looking for some help to find a solution on this:
i would need to know from c, if the ip address of an interface (example eth0) has been dhcp assigned, and also if there is a simple way to know if a dhcp server is available on the local network, and what could be the next available dhcp ip.

It will be good even if this info are stored in some /proc pipe.

Infinite thanks, angelo
 
Old 06-23-2006, 10:14 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by bit7
Hi all,

i'm looking for some help to find a solution on this:
i would need to know from c, if the ip address of an interface (example eth0) has been dhcp assigned,
Not from anything in /proc, but dhclient for instance will update
/etc/dhcpc/dhcpcd-eth0.info ... you can check the time-stamp in
the file and compare the current IP on the interface with the content
of the file aforementioned.

Quote:
Originally Posted by bit7
and also if there is a simple way to know if a dhcp server is available on the local network,
Send a dhcp request :} and see if anything answers.

Quote:
Originally Posted by bit7
and what could be the next available dhcp ip.
Only if you're on the server. The server doesn't send out lists of
"next free IPs" all the time.


Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
eth0 goes down with dhcp enabled maybbach Linux - Networking 4 04-04-2006 09:36 PM
Urgent : How to find whether the Network Interface is DHCP enabled or not ? abha_shrimal Linux - Networking 3 12-15-2005 01:50 PM
Which command in Linux can be used to know whether network card is DHCP enabled abha_shrimal Linux - Networking 1 12-13-2005 12:51 AM
DCHP server setup - how? ironChimp Linux - Networking 4 05-03-2003 02:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration