Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-03-2014, 10:09 AM
|
#1
|
Member
Registered: Aug 2004
Posts: 173
Rep:
|
can dhclient trigger actions when it gets ip from DHCP server ?
normally if eth cable up/down can trigger the scripts in the if-up.d, if-down.d.
Now sometimes our DHCP server is not good, you plugin your eth cable for your system, it won't get ip.
sometime later it gets ip.
when it gets it, is there a way i get notified and do some actions ?
|
|
|
04-04-2014, 07:17 AM
|
#2
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,466
|
As far as I know, dhclient cannot do this. However, if you are using DHCP and getting DNS addresses, these will be saved in /etc/resolv.conf. You could monitor that file for changes using inotify.
|
|
|
04-04-2014, 02:18 PM
|
#3
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797
|
You didn't mention which distro you are using, but for the Red Hat family, if you have an executable script dhclient-exit-hooks in $(ETCDIR} (normally either /etc/dhclient or /etc), then it will be sourced by /sbin/dhclient-script each time a dhclient event occurs. Since it is sourced, not called, all of the internal variables in dhclient-script are available, in particular $reason, which might be "BOUND", "RENEW", "REBIND", etc. You'll need to look at /sbin/dhclient-script for further info.
|
|
|
04-04-2014, 05:11 PM
|
#4
|
Member
Registered: Aug 2004
Posts: 173
Original Poster
Rep:
|
with stunnel on, it shows sth. like 127.0.0.1, not the real one.
Quote:
Originally Posted by allend
As far as I know, dhclient cannot do this. However, if you are using DHCP and getting DNS addresses, these will be saved in /etc/resolv.conf. You could monitor that file for changes using inotify.
|
---------- Post added 04-04-14 at 05:12 PM ----------
looks like this is what i want, using ubuntu, where should it be pls ?
Quote:
Originally Posted by rknichols
You didn't mention which distro you are using, but for the Red Hat family, if you have an executable script dhclient-exit-hooks in $(ETCDIR} (normally either /etc/dhclient or /etc), then it will be sourced by /sbin/dhclient-script each time a dhclient event occurs. Since it is sourced, not called, all of the internal variables in dhclient-script are available, in particular $reason, which might be "BOUND", "RENEW", "REBIND", etc. You'll need to look at /sbin/dhclient-script for further info.
|
|
|
|
04-04-2014, 08:19 PM
|
#5
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,797
|
You couldn't find it?? /sbin/dhclient-script is in exactly the same place, and in the /etc/dhcp directory you will find subdirectories dhclient-enter-hooks.d and dhclient-exit-hooks.d, both with some scripts for you to look at. This is on a Ubuntu 13.04 Live CD.
Last edited by rknichols; 04-04-2014 at 08:28 PM.
Reason: typo
|
|
1 members found this post helpful.
|
04-07-2014, 05:38 PM
|
#6
|
Member
Registered: Aug 2004
Posts: 173
Original Poster
Rep:
|
found it, thanks so much !
Quote:
Originally Posted by rknichols
You couldn't find it?? /sbin/dhclient-script is in exactly the same place, and in the /etc/dhcp directory you will find subdirectories dhclient-enter-hooks.d and dhclient-exit-hooks.d, both with some scripts for you to look at. This is on a Ubuntu 13.04 Live CD.
|
|
|
|
All times are GMT -5. The time now is 12:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|