where do I find the NTP server address with 'dhcpc -O ntpsrv'

Denys Vlasenko vda.linux at googlemail.com
Sun Oct 9 18:49:08 UTC 2011


On Monday 03 October 2011 15:22, Laurent Bercot wrote:
> > The NTP server ip is distributed via DHCP in my case.
> > So I want to do 'ntpd -p $NTP_SERVER'.
> > But that variable $NTP_SERVER is empty, and also /etc/ntp.conf does not 
> > exist.
> > 
> > Does anybody know where to find the NTP server's IP address received 
> > with 'dhcpc -O ntpsrc' ?

I suppose you meant "ntpsrv".


>  If I understand the udhcpc.c code correctly, result of unknown options
> listed with "-O foobar" are put into the environment via the line
>   ofs = sprintf(*curr, "opt%u=", i);

But ntpsrv is a *known* option, therefore it is exported as $ntpsrv
environment variable to the udhcpc script, a-la

ntpsrv='10.4.2.125 10.4.5.7'

See examples/var_service/dhcp_if/* for an example.

-- 
vda


More information about the busybox mailing list