Re: ntpdate on boot problem

2011-11-07 Thread Robison, Dave

On 11/05/2011 14:52, Robert Simmons wrote:

Is there a way to make sure that the interface is UP and working
before running ntpdate at boot on a box with a static IP address?

After setting ntpdate_enable="YES" in rc.conf, I get the following
error on boot:

Setting date via ntp.
Error : hostname nor servname provided, or not known
  5 Nov 17:11:05
ntpdate[786]: can't find host 0.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
  5 Nov 17:11:05
ntpdate[786]: can't find host 1.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
  5 Nov 17:11:05
ntpdate[786]: can't find host 2.freebsd.pool.ntp.org

  5 Nov 17:11:05
ntpdate[786]: no servers can be used, exiting

I've had this problem with machines using DHCP and the solution was to
use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
a static IP address.  But the problem seems to be similar.

Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"





I believe the easiest answer to your question is to do the following in 
/etc/rc.conf:


netwait_enable="YES"
netwait_ip="$defaultrouter"

This will cause your interface to wait until it can ping the default router.

http://lists.freebsd.org/pipermail/freebsd-rc/2010-June/001987.html

Enjoy,

Dave


--
Dave Robison
Sales Solution Architect II
FIS Banking Solutions
510/621-2089 (w)
530/518-5194 (c)
510/621-2020 (f)
da...@vicor.com
david.robi...@fisglobal.com

_
The information contained in this message is proprietary and/or confidential. 
If you are not the intended recipient, please: (i) delete the message and all 
copies; (ii) do not disclose, distribute or use the message in any manner; and 
(iii) notify the sender immediately. In addition, please be aware that any 
message addressed to our domain is subject to archiving and review by persons 
other than the intended recipient. Thank you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-07 Thread krad
On 6 November 2011 02:51, Robert Simmons  wrote:

> On Sat, Nov 5, 2011 at 7:43 PM, Warren Block  wrote:
> > netwait_enable="YES"
> > netwait_ip="192.168.1.1" # IP address to ping to verify network is up
> > netwait_if="em0" # interface to use
> >
> >
> > Also there's netwait_timeout, which defaults to 60 in
> /etc/defaults/rc.conf.
>
> I've finally got a combination of suggested configurations that get me
> to where I want to be (using ntpd, ntpdate, and netwait).
>
> However, I've found that I still need ntpdate_enable="YES" rather than
> ntpd_sync_on_start="YES".  The reason for this is that I'm running at
> securelevel 3, and ntpd takes too long to get up, running, and sync
> the clock.  By the time it tries to adjust the clock, secure level has
> already been raised preventing the adjustment.
>
> Is there a way to make securelevel wait until ntpd has made its
> adjustments?  When I use ntpdate at this point, it seems like the init
> scripts are sequential, and it waits until ntpdate is done before
> continuing and later raising securelevel.
>
> It seems that even though ntpdate is deprecated that it is still
> required if you want to run securelevel 3.
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscr...@freebsd.org"
>


Another thing you may want to look at is your switchport config (assuming
its managed), if you are running STP it can take upto a minute for the port
to go into forwarding state after the line is up. You can do two things to
get around this.

1. use rstp instead - this is the better safer way forward. However you may
not have control of the network and could be a big thing to do depending on
your organization.
2. enable portfast on the relevant switches. This is potentially dangerous
as it disables stp and therefore potentially exposes you to switching
loops. However if the port is only ever plugged into on machine and EU dont
play with the cables shold be fine
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Carl Johnson
Matthew Seaman  writes:

> On 05/11/2011 22:19, Robert Simmons wrote:
>> On Sat, Nov 5, 2011 at 6:03 PM, Alexander Best  wrote:
>>> same here. simply add something like the following to your crontab:
>>>
>>> 0   10  *   *   */2 /etc/rc.d/ntpdate onestart
>> 
>> I have something similar in my crontab which is not exactly what I
>> need.  I want to make sure that the clock is set at every boot because
>> I'm using this as a kerberos server.  If the clock is not set properly
>> at boot, kerberos will not work properly until the nightly cron jobs
>> are run and the clock is set then.  I need everything working at boot.
>>  I can't have a window of problems between boot and midnight or
>> whenever cron runs ntpdate.
>
> crontabs have this handy '@reboot' syntax...  It's all explained in
> crontab(5).

Just be aware that 'Run once, at startup', means when 'cron' starts, not
just when the system boots, unless they have changed it recently.

-- 
Carl Johnsonca...@peak.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Robert Simmons
On Sat, Nov 5, 2011 at 7:43 PM, Warren Block  wrote:
> netwait_enable="YES"
> netwait_ip="192.168.1.1" # IP address to ping to verify network is up
> netwait_if="em0" # interface to use
>
>
> Also there's netwait_timeout, which defaults to 60 in /etc/defaults/rc.conf.

I've finally got a combination of suggested configurations that get me
to where I want to be (using ntpd, ntpdate, and netwait).

However, I've found that I still need ntpdate_enable="YES" rather than
ntpd_sync_on_start="YES".  The reason for this is that I'm running at
securelevel 3, and ntpd takes too long to get up, running, and sync
the clock.  By the time it tries to adjust the clock, secure level has
already been raised preventing the adjustment.

Is there a way to make securelevel wait until ntpd has made its
adjustments?  When I use ntpdate at this point, it seems like the init
scripts are sequential, and it waits until ntpdate is done before
continuing and later raising securelevel.

It seems that even though ntpdate is deprecated that it is still
required if you want to run securelevel 3.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Warren Block

On Sat, 5 Nov 2011, d...@safeport.com wrote:


On Sat, 5 Nov 2011, Warren Block wrote:

On Sat, 5 Nov 2011, Robert Simmons wrote:


I've had this problem with machines using DHCP and the solution was to
use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
a static IP address.  But the problem seems to be similar.


Yes, it is.  FreeBSD 8-STABLE and 9 have /etc/rc.d/netwait just for this.


I do not see this in the handbook. Did I just miss it?. IMO the necessary 
synchronization should just be built in to booting.


AFAIK it's not in the Handbook yet.  The problem is that some network 
interfaces actually take a while to come up after ifconfig is done 
setting them up.  The amount of time taken could depend on the local 
network with autonegotiation and such.


Another approach is to set up the DHCP server--if there is one--to 
assign static addresses based on MAC address.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Warren Block

On Sat, 5 Nov 2011, Robert Simmons wrote:


On Sat, Nov 5, 2011 at 6:55 PM, Warren Block  wrote:

On Sat, 5 Nov 2011, Robert Simmons wrote:

Is there a way to make sure that the interface is UP and working
before running ntpdate at boot on a box with a static IP address?

Yes, it is.  FreeBSD 8-STABLE and 9 have /etc/rc.d/netwait just for this.


Thanks, could you elaborate as to how I use netwait at boot to run ntpdate?


Untested:

netwait_enable="YES"
netwait_ip="192.168.1.1" # IP address to ping to verify network is up
netwait_if="em0" # interface to use


Also there's netwait_timeout, which defaults to 60 in 
/etc/defaults/rc.conf.___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Re: ntpdate on boot problem

2011-11-05 Thread Robert Simmons
On Sat, Nov 5, 2011 at 6:33 PM, Matthew Seaman
 wrote:
> crontabs have this handy '@reboot' syntax...  It's all explained in
> crontab(5).

Thanks!

> However, you would be well advised to run ntpd(8) rather than bodging
> the clock with ntpdate at intervals.  ntpdate is deprecated by the ntp
> project, given that ntpd now has the capability to synch the clock the
> first time after restart no matter what the offset.  Just add these
> rc.conf settings:
>
> ntpd_enable="YES"
> ntpd_sync_on_start="YES"

Thanks again, this works without any problems.  I'm still curious how
to get the ntpdate adjustment to occur later in the boot process after
the network interface is UP, but now it's merely academic.

Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Robert Simmons
On Sat, Nov 5, 2011 at 6:55 PM, Warren Block  wrote:
> On Sat, 5 Nov 2011, Robert Simmons wrote:
>> Is there a way to make sure that the interface is UP and working
>> before running ntpdate at boot on a box with a static IP address?
> Yes, it is.  FreeBSD 8-STABLE and 9 have /etc/rc.d/netwait just for this.

Thanks, could you elaborate as to how I use netwait at boot to run ntpdate?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Warren Block

On Sat, 5 Nov 2011, Robert Simmons wrote:


Is there a way to make sure that the interface is UP and working
before running ntpdate at boot on a box with a static IP address?

After setting ntpdate_enable="YES" in rc.conf, I get the following
error on boot:

Setting date via ntp.
Error : hostname nor servname provided, or not known
5 Nov 17:11:05
ntpdate[786]: can't find host 0.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
5 Nov 17:11:05
ntpdate[786]: can't find host 1.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
5 Nov 17:11:05
ntpdate[786]: can't find host 2.freebsd.pool.ntp.org

5 Nov 17:11:05
ntpdate[786]: no servers can be used, exiting

I've had this problem with machines using DHCP and the solution was to
use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
a static IP address.  But the problem seems to be similar.


Yes, it is.  FreeBSD 8-STABLE and 9 have /etc/rc.d/netwait just for 
this.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Matthew Seaman
On 05/11/2011 22:19, Robert Simmons wrote:
> On Sat, Nov 5, 2011 at 6:03 PM, Alexander Best  wrote:
>> same here. simply add something like the following to your crontab:
>>
>> 0   10  *   *   */2 /etc/rc.d/ntpdate onestart
> 
> I have something similar in my crontab which is not exactly what I
> need.  I want to make sure that the clock is set at every boot because
> I'm using this as a kerberos server.  If the clock is not set properly
> at boot, kerberos will not work properly until the nightly cron jobs
> are run and the clock is set then.  I need everything working at boot.
>  I can't have a window of problems between boot and midnight or
> whenever cron runs ntpdate.

crontabs have this handy '@reboot' syntax...  It's all explained in
crontab(5).

However, you would be well advised to run ntpd(8) rather than bodging
the clock with ntpdate at intervals.  ntpdate is deprecated by the ntp
project, given that ntpd now has the capability to synch the clock the
first time after restart no matter what the offset.  Just add these
rc.conf settings:

ntpd_enable="YES"
ntpd_sync_on_start="YES"

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matt...@infracaninophile.co.uk   Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: ntpdate on boot problem

2011-11-05 Thread Michael Sierchio
The keywords in /etc/rc.d/ntpdate have

# PROVIDE: ntpdate
# REQUIRE: NETWORKING syslogd named
# KEYWORD: nojail

which means that networking must be up first.  The question in your
case is why name resolution is failing.

See what happens if you pick some public stratum 1 or stratum 2
servers for your ntp.conf.  Then try specifying IP addrs instead of
FQDNs
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Robert Simmons
On Sat, Nov 5, 2011 at 6:03 PM, Alexander Best  wrote:
> same here. simply add something like the following to your crontab:
>
> 0       10      *       *       */2     /etc/rc.d/ntpdate onestart

I have something similar in my crontab which is not exactly what I
need.  I want to make sure that the clock is set at every boot because
I'm using this as a kerberos server.  If the clock is not set properly
at boot, kerberos will not work properly until the nightly cron jobs
are run and the clock is set then.  I need everything working at boot.
 I can't have a window of problems between boot and midnight or
whenever cron runs ntpdate.

Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Robert Simmons
On Sat, Nov 5, 2011 at 5:57 PM, Michael Sierchio  wrote:
> Are you running a firewall?  Do you have a ppp connection?

I'm not running a firewall on the machine in question.  I am behind a
firewall, if that's what you mean.  I don't have a ppp connection.
The box is a server that is running on bare metal, no VM.  Fixed IP
address (198.162) behind a NAT firewall.

But, after booting, everything works correctly:

# /etc/rc.d/ntpdate onestart
Setting date via ntp.
 5 Nov 18:09:31 ntpdate[1324]: step time server 128.10.254.7 offset
-0.000537 sec

>
> This happens when there is a dependency that is not expressed in the
> /etc/rc.d scripts.

Can you elaborate?  My rc.conf looks like this (pretty simple):

hostname="example"
ifconfig_sk0="inet 192.168.1.5 netmask 0xff00"
defaultrouter="192.168.1.1"
sshd_enable="YES"

#Screensaver
saver="daemon"

#Encrypted swap
geli_swap_flags="-d -l 256 -s 4096"

#/tmp in memory
tmpmfs="YES"

#Kerberos
kerberos5_server_enable="YES"
kadmind5_server_enable="YES"

#Time
ntpdate_enable="YES"


Also, the box is 8.2-RELEASE with current updates via freebsd-update.

Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Alexander Best
On Sat Nov  5 11, Robert Simmons wrote:
> Is there a way to make sure that the interface is UP and working
> before running ntpdate at boot on a box with a static IP address?
> 
> After setting ntpdate_enable="YES" in rc.conf, I get the following
> error on boot:
> 
> Setting date via ntp.
> Error : hostname nor servname provided, or not known
>  5 Nov 17:11:05
> ntpdate[786]: can't find host 0.freebsd.pool.ntp.org
> 
> Error : hostname nor servname provided, or not known
>  5 Nov 17:11:05
> ntpdate[786]: can't find host 1.freebsd.pool.ntp.org
> 
> Error : hostname nor servname provided, or not known
>  5 Nov 17:11:05
> ntpdate[786]: can't find host 2.freebsd.pool.ntp.org
> 
>  5 Nov 17:11:05
> ntpdate[786]: no servers can be used, exiting
> 
> I've had this problem with machines using DHCP and the solution was to
> use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
> a static IP address.  But the problem seems to be similar.

same here. simply add something like the following to your crontab:

0   10  *   *   */2 /etc/rc.d/ntpdate onestart

cheers.
alex

> 
> Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: ntpdate on boot problem

2011-11-05 Thread Michael Sierchio
Are you running a firewall?  Do you have a ppp connection?

This happens when there is a dependency that is not expressed in the
/etc/rc.d scripts.

- M

On Sat, Nov 5, 2011 at 2:52 PM, Robert Simmons  wrote:
> Is there a way to make sure that the interface is UP and working
> before running ntpdate at boot on a box with a static IP address?
>
> After setting ntpdate_enable="YES" in rc.conf, I get the following
> error on boot:
>
> Setting date via ntp.
> Error : hostname nor servname provided, or not known
>  5 Nov 17:11:05
> ntpdate[786]: can't find host 0.freebsd.pool.ntp.org
>
> Error : hostname nor servname provided, or not known
>  5 Nov 17:11:05
> ntpdate[786]: can't find host 1.freebsd.pool.ntp.org
>
> Error : hostname nor servname provided, or not known
>  5 Nov 17:11:05
> ntpdate[786]: can't find host 2.freebsd.pool.ntp.org
>
>  5 Nov 17:11:05
> ntpdate[786]: no servers can be used, exiting
>
> I've had this problem with machines using DHCP and the solution was to
> use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
> a static IP address.  But the problem seems to be similar.
>
> Rob
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


ntpdate on boot problem

2011-11-05 Thread Robert Simmons
Is there a way to make sure that the interface is UP and working
before running ntpdate at boot on a box with a static IP address?

After setting ntpdate_enable="YES" in rc.conf, I get the following
error on boot:

Setting date via ntp.
Error : hostname nor servname provided, or not known
 5 Nov 17:11:05
ntpdate[786]: can't find host 0.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
 5 Nov 17:11:05
ntpdate[786]: can't find host 1.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
 5 Nov 17:11:05
ntpdate[786]: can't find host 2.freebsd.pool.ntp.org

 5 Nov 17:11:05
ntpdate[786]: no servers can be used, exiting

I've had this problem with machines using DHCP and the solution was to
use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
a static IP address.  But the problem seems to be similar.

Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


ntpdate on boot problem

2011-11-05 Thread Robert Simmons
Is there a way to make sure that the interface is UP and working
before running ntpdate at boot on a box with a static IP address?

After setting ntpdate_enable="YES" in rc.conf, I get the following
error on boot:

Setting date via ntp.
Error : hostname nor servname provided, or not known
 5 Nov 17:11:05
ntpdate[786]: can't find host 0.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
 5 Nov 17:11:05
ntpdate[786]: can't find host 1.freebsd.pool.ntp.org

Error : hostname nor servname provided, or not known
 5 Nov 17:11:05
ntpdate[786]: can't find host 2.freebsd.pool.ntp.org

 5 Nov 17:11:05
ntpdate[786]: no servers can be used, exiting

I've had this problem with machines using DHCP and the solution was to
use SYNCDHCP rather than DHCP in rc.conf.  However, this box is using
a static IP address.  But the problem seems to be similar.

Rob
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"