You are not logged in.

#1 2021-07-28 23:51:55

ritchan
Member
Registered: 2013-10-06
Posts: 13

Why is a new IP on the network not immediately recognized by others?

I've noticed many times that it takes time for other hosts on a network to be able to reach a new host that has just joined the network. Why is this?

For instance, 192.168.1.42 is my iPhone, running a FTP server. 1.226 is my laptop, and it can't find it, but eventually does.
```
From 192.168.1.226 icmp_seq=25 Destination Host Unreachable
From 192.168.1.226 icmp_seq=26 Destination Host Unreachable
From 192.168.1.226 icmp_seq=27 Destination Host Unreachable
64 bytes from 192.168.1.42: icmp_seq=28 ttl=64 time=2029 ms
64 bytes from 192.168.1.42: icmp_seq=29 ttl=64 time=1019 ms
64 bytes from 192.168.1.42: icmp_seq=30 ttl=64 time=5.55 ms
64 bytes from 192.168.1.42: icmp_seq=31 ttl=64 time=73.0 ms
```

Offline

#2 2021-07-29 06:35:18

seth
Member
Registered: 2012-09-03
Posts: 49,990

Re: Why is a new IP on the network not immediately recognized by others?

Quantify "time".

"recognized" as for "ping" means that the new client receives and responds to ICMP requests.
This requires
1. The router to… well, route, the ICMP packages there (ie. the new host got a registered lease)
2. The new host to have configured its routing table to know where direct the reply

If you're using a wifi connection and the host (your iPhone) shows a nifty radio icon eg. as soon as it has associated w/ an AP, that does not mean it has "joined the network".
It'll have to authenticate, send a dhcp request, get a lease and configure its routing table - what can take a few seconds.

The interesting question would be whether the new host can already ping present ones (long) before itself starts echos to ICMP requests.

Online

#3 2021-07-29 12:56:28

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Why is a new IP on the network not immediately recognized by others?

For on link hosts, which is what you're describing, no router is in play.
So what happens when you ping (or any IPv4 chatter) a new address is this:

ARP entry created. This entry for the address will hold all timing information.
ARP probe sent.
If a reply is received, that sending hardware address is stored in the ARP entry and host to host communication can start.
If a reply is not received then another ARP probe is sent. This process gets slower until a ceiling is reached, generally around the 1 minute mark. This is to avoid flooding the network with ARP probes that go nowhere.
On Linux and NetBSD, this process is also shared IPv6 ND code (actually the reverse, but this is easier to explain).

This means that if you ping an address before it's on the network it will seem to take a long time before it appears to actually find it.
If it's already active on the network for more than say 10 seconds then you have a networking problem between the hosts to solve.

Offline

#4 2021-07-29 13:36:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: Why is a new IP on the network not immediately recognized by others?

rsmarples wrote:

For on link hosts... no router is in play.

Could you elaborate on how / why this is?  The different devices are only connected via the router, so how can it not be "in play"?  If the router doesn't do it's job at that moment, the ping will not go through.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2021-07-29 14:07:30

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 1,932
Website

Re: Why is a new IP on the network not immediately recognized by others?

Trilby wrote:
rsmarples wrote:

For on link hosts... no router is in play.

Could you elaborate on how / why this is?  The different devices are only connected via the router, so how can it not be "in play"?  If the router doesn't do it's job at that moment, the ping will not go through.

A router connects networks, a switch connects hosts.
What most consumers have at home and call a "router" is an Integrated Access Device (IAD) - a combination of switch, router, wifi access point, modem, DECT client, etc.

Offline

#6 2021-07-29 20:33:05

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Why is a new IP on the network not immediately recognized by others?

Exactly so.

I forgot to mention, but you can see the ARP entries (and IPv6 ND entires) using the `ip n` command. It should show the timings as well.

Offline

Board footer

Powered by FluxBB