# ntp won't work (address family not supported by protocol)

## bitpicker

Following the wiki HowTo for ntp I got stuck pretty early in the process. Ntpdate won't work properly. Using 

```

netselect -s 3 de.pool.ntp.org

```

I found the IP addresses of three German ntp servers to use; my /etc/conf.d/ntp-client now looks like this (comments removed):

```

NTPCLIENT_CMD="ntpdate"

NTPCLIENT_OPTS=" -b -u 62.206.253.10 80.190.252.238 81.169.136.18"

NTPCLIENT_TIMEOUT=30

```

The -u parameter was in there by default, it is not in the Wiki article and I have tried both versions with the same result. When trying to run the client I get:

```

/etc/init.d/ntpd-client start

* Setting clock via the NTP client 'ntpdate' ...

/etc/init.d/ntp-client: line 34:  5854 Getötet                ${NTPCLIENT_CMD} ${NTPCLIENT_OPTS} >/dev/null

 * Failed to set clock  

```

('Getötet' means 'killed')

If I run ntpdate with the above parameters or for instance de.pool.ntp.org instead of the IPs, I get

```

ntpdate -b de.pool.ntp.org

 1 Jan 10:20:54 ntpdate[5911]: poll(): nfound = 0, error: Address family not supported by protocol

```

I am using a router to connect to the internet, and it has an in-built firewall, but I have set it to forward port 123, both UDP and TCP, to my internal IP.

Does anyone have an idea what I could try next?

Robin

----------

## adaptr

 *Quote:*   

> I am using a router to connect to the internet, and it has an in-built firewall, but I have set it to forward port 123, both UDP and TCP, to my internal IP. 

 

Not needed as long as you use -u.

I would check whether ntpdate (package ntp) was compiled with the right protocol(s).

As a first test, run it with the -4 option to force ipv4 addresses.

Why ever use IP addesses anyhow ?

Just use de.pool.ntp.org as your server; that picks a random one from that pool (as it is intended to be used).

There are over a dozen servers in the pool.

----------

## bitpicker

Using de.pool.ntp.org doesn't change the problem. I've tried -4, too, and it still doesn't work; moreover, when I use -6 just to check I get an immediate error:

```

Error : No address associated with hostname

 1 Jan 17:29:21 ntpdate[5944]: can't find host de.pool.ntp.org

 1 Jan 17:29:21 ntpdate[5944]: no servers can be used, exiting

```

The original error appears after timeout only.

Robin

----------

## mmbrothers

Does your machine resolve any DNS addresses correctly?  Can you ping a remote hostname or use dig to get a dns record

```

dig www.google.com

```

Last edited by mmbrothers on Sun Jan 01, 2006 5:01 pm; edited 1 time in total

----------

## bitpicker

I can ping de.pool.ntp.org ok, and other DNS resolutions work, too - I can use a browser, emerge etc.; though I do have problems with the ftp servers for emerge occasionally and emerge sometimes tries its way through a number of them with timing out. I put that down to holiday traffic ... (?) I've only been on Gentoo for a week, so I don't know whether that's going to be a constant problem. There might be something wrong with my net setup, but not in a way that it is completely broken.

```

ping de.pool.ntp.org

PING de.pool.ntp.org (84.16.227.206) 56(84) bytes of data.

64 bytes from de.pool.ntp.org (84.16.227.206): icmp_seq=1 ttl=52 time=82.0 ms

64 bytes from de.pool.ntp.org (84.16.227.206): icmp_seq=2 ttl=52 time=80.4 ms

64 bytes from de.pool.ntp.org (84.16.227.206): icmp_seq=3 ttl=52 time=95.4 ms

64 bytes from de.pool.ntp.org (84.16.227.206): icmp_seq=4 ttl=52 time=96.5 ms

--- de.pool.ntp.org ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3013ms

rtt min/avg/max/mdev = 80.467/88.609/96.507/7.381 ms

```

Robin

----------

## magic919

Have you turned off the port forwarding on your router?

Are you able to run the ntpdate command directly with -d to see if it gives any more data.

----------

## bitpicker

The router does not have an option for turning off port forwarding altogether; you can only open individual ports. The -d parameter doesn't change anything, the error output is still the same.

Robin

----------

## PaulBredbury

Try emerging a masked version of bind (I've happily used both 9.2.5-r6 and 9.3.1-r8 ), and ensure it's emerged with safe CFLAGS.

----------

## bitpicker

I have emerged 9.3.1-r8; no change.    :Sad: 

Robin

----------

## bitpicker

Can't really put 'solved' in the topic line, but using chrony works for me. That's good enough.

Robin

----------

## lim_on

hm i have the same problem..and i don`t know where is the problem ;o(

```

ntpdate -v pool.ntp.org

29 Mar 20:33:25 ntpdate[19899]: ntpdate 4.2.0a@1.1190-r Wed Mar 29 20:11:04 CEST 2006 (1)

29 Mar 20:34:25 ntpdate[19899]: poll(): nfound = 0, error: Address family not supported by protocol

ntpdate -4 -v pool.ntp.org

29 Mar 20:35:16 ntpdate[20040]: ntpdate 4.2.0a@1.1190-r Wed Mar 29 20:11:04 CEST 2006 (1)

29 Mar 20:36:16 ntpdate[20040]: poll(): nfound = 0, error: Address family not supported by protocol

 ntpdate -4 -v -b pool.ntp.org

29 Mar 20:36:21 ntpdate[20122]: ntpdate 4.2.0a@1.1190-r Wed Mar 29 20:11:04 CEST 2006 (1)

29 Mar 20:37:21 ntpdate[20122]: poll(): nfound = 0, error: Address family not supported by protocol

```

```

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3

connect(3, {sa_family=AF_INET, sin_port=htons(123), sin_addr=inet_addr("81.169.171.179")}, 16) = 0

close(3)                                = 0

open("/etc/services", O_RDONLY)         = 3

fcntl64(3, F_GETFD)                     = 0

fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0

fstat64(3, {st_mode=S_IFREG|0644, st_size=35832, ...}) = 0

mmap2(NULL, 131072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e55000

read(3, "# /etc/services\n#\n# Network serv"..., 131072) = 35832

close(3)                                = 0

munmap(0xb7e55000, 131072)              = 0

socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = -1 EAFNOSUPPORT (Address family not supported by protocol)

socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3

connect(3, {sa_family=AF_INET, sin_port=htons(123), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

getsockname(3, {sa_family=AF_INET, sin_port=htons(36183), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0

close(3)                                = 0

socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3

setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0

bind(3, {sa_family=AF_INET, sin_port=htons(123), sin_addr=inet_addr("0.0.0.0")}, 16) = 0

fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0

socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP) = -1 EAFNOSUPPORT (Address family not supported by protocol)

rt_sigaction(SIGALRM, {0x8049300, [], 0}, {SIG_DFL}, 8) = 0

setitimer(ITIMER_REAL, {it_interval={0, 200000}, it_value={0, 100000}}, NULL) = 0

setpriority(PRIO_PROCESS, 0, -12)       = 0

poll(

[{fd=3, events=POLLIN}], 1, 60000) = 0

time(NULL)                              = 1143657531

write(1, "29 Mar 20:38:51 ntpdate[20241]: "..., 10029 Mar 20:38:51 ntpdate[20241]: poll(): nfound = 0, error: Address family not supported by protocol

) = 100

poll(

```

----------

## guid0

ancient thread but i just ran into this issue. in case someone else hits this i had a incomplete /etc/shadow.

running "pwconf" and /etc/init.d/ntpd restart fixed it for me.

----------

