# [Solved] NTP client ntpdate conflicts with  eth0 vs. wlan0

## cgmd

Hi, All...

I'm trying to resolve an issue I experience with NTP client... it won't start when I boot my laptop and both net.eth0 &  net.wlan0 are running. If I boot with just net.eth0 or just net.wlan.0, NTP client starts without problem. 

The error message I see is: 

```

* Setting clock via the NTP client ntpdate 

/etc/init.d/ntp-client: line 33:  9743 Killed               ${NTPCLIENT_CMD} ${NTPCLIENT_OPTS} >/dev/null

* Failed to set clock                                                                                                                                                              [ !! ]

```

Has anyone else encountered this? Is there a resolution?

Thanks...

----------

## kfiaciarka

Just post 

```
rc-update show
```

And /etc/conf.d/net

I think that setting network as static will solve your problem. But provide more info here.[/quote]

----------

## cgmd

kfiaciarka wrote:

 *Quote:*   

> Just post
> 
> Code:
> 
> rc-update show
> ...

 

Output from rc-update show: 

```
 

           alsasound | boot                          

             apache2 |                               

            bootmisc | boot                          

                cdrw |      default                  

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

         crypto-loop |                               

               cupsd |      default                  

                dbus |      default                  

          domainname |      default                  

              esound |                               

                famd |                               

               fcron |      default                  

           fetchmail |                               

            gkrellmd |                               

                 gpm |                               

                hald |      default                  

              hdparm |                               

            hostname | boot                          

             hotplug |                               

             ifplugd |      default                  

               ivman |      default                  

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

                 mpd |      default                  

            net.eth0 |      default                  

              net.lo | boot                          

           net.wlan0 |      default                  

            netmount |      default                  

                nscd |                               

          ntp-client |      default                  

                ntpd |      default                  

             numlock |                               

              pcmcia |      default                  

             pktcdvd |                               

     pop-before.smtp |                               

             portmap |                               

           rmnologin | boot                          

              rsyncd |                               

               samba |                               

              serial | boot                          

                sshd |      default                  

           syslog-ng |      default                  

             urandom | boot                          

      wpa_supplicant |                               

                 xdm |                   
```

...and contents of /etc/conf.d/net: 

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $

# Global config file for net.* rc-scripts

# This is basically the ifconfig argument without the ifconfig $iface

#

#iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"

#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"

# For DHCP set iface_eth? to "dhcp"

# For passing options to dhcpcd use dhcpcd_eth?

#

iface_eth0="dhcp"

iface_wlan0="dhcp"

dhcpcd_eth0="-t 5"

# For adding aliases to a interface

#

#alias_eth0="192.168.0.3 192.168.0.4"

# NB:  The next is only used for aliases.

#

# To add a custom netmask/broadcast address to created aliases,

# uncomment and change accordingly.  Leave commented to assign

# defaults for that interface.

#

#broadcast_eth0="192.168.0.255 192.168.0.255"

#netmask_eth0="255.255.255.0 255.255.255.0"

# For setting the default gateway

#

#gateway="eth0/192.168.0.1"

```

Thank you, kfiaciarka...

----------

## kfiaciarka

Just make your network static! or emerge dhcp and add it to default rc-update level.

----------

## cgmd

 *Quote:*   

> Just make your network static!

 

... how would make it static, if it's a laptop that moves from place to place?   :Confused: 

----------

## kfiaciarka

 *cgmd wrote:*   

>  *Quote:*   Just make your network static! 
> 
> ... how would make it static, if it's a laptop that moves from place to place?  

 

So pick the second option  :Smile: 

----------

## cgmd

Then, how would dhcp differ from dhcpcd, which I currently have installed?  :Question: 

----------

## kfiaciarka

 *cgmd wrote:*   

> Then, how would dhcp differ from dhcpcd, which I currently have installed? 

 

You don't have dhcpcd option in rc-update whereas dhcp is there. Just do it and check out results.

----------

## Genone

 *kfiaciarka wrote:*   

>  *cgmd wrote:*   Then, how would dhcp differ from dhcpcd, which I currently have installed?  
> 
> You don't have dhcpcd option in rc-update whereas dhcp is there. Just do it and check out results.

 

Ehm, you really don't need (and don't want) a dhcp server on a laptop ...

cgmd: What do the routing tables look like (output of `route -n`)?

----------

## ebichu

Are you sure you need both ntpd and ntp-client running? I thought you just needed ntpd. (Not 100% sure as I switched to using openntpd on my system.)

----------

## cgmd

Genone wrote: *Quote:*   

> 
> 
> Ehm, you really don't need (and don't want) a dhcp server on a laptop ...
> 
> cgmd: What do the routing tables look like (output of `route -n`)?
> ...

 

Here's what I get, imediately after a reboot, and before tampering with any settings...

```
 cgmd # route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0

0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0

```

And, btw, this problem occurs at my "place of work" network. At my home lan, ntpdate starts and sets the clock normally.  :Confused: 

----------

## Genone

There is your problem, you have two default routes set, and the system probably can't decide which one to use, you should increase the metric of one route in /etc/conf.d/net (sorry, too lazy to check for the correct instructions)

----------

## cgmd

 *Quote:*   

> There is your problem, you have two default routes set, and the system probably can't decide which one to use, you should increase the metric of one route in /etc/conf.d/net (sorry, too lazy to check for the correct instructions)

 

I have not figured out the "correct instructions" to place in /etc/conf.d/net... 

Does anyone have a suggestion??

Thanks...

----------

## cgmd

Since the problem lies in the inability of NTP client ntpdate to set the clock when both eth0 and wlan0 are active, is there a possibility to make NTP client ntpdate default to eth0 and only use wlan0 when etho is not existant?

Just a thought!   :Confused: 

----------

## ghost_o

I am having this same issue.  It just started with the baselayout from 2006.0 - I never experienced it before from gentoo 2.3 -> 2005.1 .   When eth0 is up it runs, but when eth1 is up and no cable is in eth0, it dies.  It gets old having to open an xterm and start it in X, which then kickstarts the screensaver since my hwclock battery is dead in this laptop.

Anyone find a solution - I do not have 2 default routes like above.

----------

## cgmd

ghost_o wrote: *Quote:*   

> I am having this same issue. It just started with the baselayout from 2006.0

 I can't honestly say when the problem began for me, but it may have started just after emerging:

```
=== 2006-03-03 07:27 =========== baselayout-1.11.14-r6 ===

```

Also of note with my problrm is it's occurrence when using the network at work, but I have no problem with NTP client ntpdate functioning when I use my laptop at home (both eth0 and wlan0 activating, as well).  :Confused: 

----------

## Genone

 *cgmd wrote:*   

>  *Quote:*   There is your problem, you have two default routes set, and the system probably can't decide which one to use, you should increase the metric of one route in /etc/conf.d/net (sorry, too lazy to check for the correct instructions) 
> 
> I have not figured out the "correct instructions" to place in /etc/conf.d/net... 
> 
> Does anyone have a suggestion??
> ...

 

Ok, finally managed to unpack my laptop again, the way I'm changing metric for the wlan interface is to add

```
dhcpcd_wlan="-m 2"
```

to /etc/conf.d/net (where "wlan" is one of the network interfaces).

The result is that the system will first try to route packets via the lan interface (as it has metric 0) and only if that fails use the wlan interface.

----------

## kfiaciarka

You can also try set clock via rdate:)

----------

## cgmd

Genone wrote: *Quote:*   

> Ok, finally managed to unpack my laptop again, the way I'm changing metric for the wlan interface is to add
> 
> Code:
> 
> dhcpcd_wlan="-m 2"
> ...

 

Today, Genone is my best friend! The problem is fixed, at last!!   :Very Happy: 

----------

