LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-20-2014, 03:03 AM   #1
a.cohen
LQ Newbie
 
Registered: Oct 2013
Posts: 16

Rep: Reputation: Disabled
Get DHCP client info from dhclient hooks


Hi,
i use a dhclient in my embedded system. and i need to get the dhcp info such as the leased ip-address, the default GW, the server ip and other dhcp options (expiry time etc..)
i know that i can extract these info from the dhclient.leases file - but this is a log file, and every new lease is appended to the end of the dhclient.leases file, and i prefer to get all this info using the dhclient-exit-hook.
i want to invoke a program (that i will write) to run automaticaly from this hook and that program will get these info as input.
can someone help how to write the dhclient-exit-hook script to do this job?
Thanks and regards,
Avi
 
Old 08-20-2014, 02:30 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
You can use nmcli command to retrieve DHCP information. On fedora 20, the command is "nmcli device show interface_name".
 
Old 08-21-2014, 03:19 AM   #3
a.cohen
LQ Newbie
 
Registered: Oct 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
i dont have this command in my centos. anyway i need to get these info from the dhclient-exit-hook that will run my program.
my program can get these info from some env. vars that can be seen in the /etc/dhclient-script
Thanks Avi
 
  


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
daemon.info dhclient error elenta Linux - Networking 1 07-12-2011 01:24 AM
LXer: Google hooks Native Client into Visual Basic, Eclipse LXer Syndicated Linux News 0 05-12-2011 06:10 PM
dhclient 'flaw'; request for info salasi Linux - Security 5 04-12-2011 01:50 PM
dhclient-exit-hooks not starting script ocgltd Linux - Networking 7 09-06-2006 08:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:58 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