Configuring Arp Age Timeout

ARP Timeouts. Why fixed periodic?

RFC1122 Requirements for Internet Hosts discusses this.

     2.3.2.1  ARP Cache Validation

An implementation of the Address Resolution Protocol (ARP)
[LINK:2] MUST provide a mechanism to flush out-of-date cache
entries. If this mechanism involves a timeout, it SHOULD be
possible to configure the timeout value.

...

DISCUSSION:
The ARP specification [LINK:2] suggests but does not
require a timeout mechanism to invalidate cache entries
when hosts change their Ethernet addresses. The
prevalence of proxy ARP (see Section 2.4 of [INTRO:2])
has significantly increased the likelihood that cache
entries in hosts will become invalid, and therefore
some ARP-cache invalidation mechanism is now required
for hosts. Even in the absence of proxy ARP, a long-
period cache timeout is useful in order to
automatically correct any bad ARP data that might have
been cached.

Networks can be very dynamic; DHCP servers can assign the same IP address to different computers when old lease times expire (making current ARP data invalid), there can be IP conflicts that will never be noticed unless ARP requests are periodically made, etc.

It also provides a mechanism for checking if a host is still on the network. Imagine you're streaming a video over UDP to some IP address 192.168.0.5. If you cache the MAC address of that machine forever, you'll just keep spamming out UDP packets even if the host goes down. Doing an ARP request every now and then will stop the stream with a destination unreachable error because no one responded with a MAC for that IP.

Android ARP clearing time

Android is based on the Linux kernel and uses the same sort of ARP timeout policy. Entries in the cache timeout somewhere between base_reachable_time/2 and 3*base_reachable_time/2, with base_reachable_time defaulting to 30 seconds or so. You may be able to change this setting by changing the kernel parameters via the proc interface at /proc/sys/net/ipv4/neigh/eth0/base_reachable_time, but the phone will need to be rooted. You could also just ping the IP you want the MAC of before checking the table to keep the entry in the cache updated.

TCP ceases retransmissions before reaching the default of 15 attempts (after physical disconnection)

Maybe the entry in the ARP table is expiring and when the ARP requests are sent again there is a timeout for no-reponse? Did you run arp -a?
Maybe setting gc_timeout is not enough and you also need to set gc_stale_time? I read at this entry with a great explanation about how it works. The guy was trying to do almost the opposite you are trying. Configuring ARP age timeout

There is another thread to investigate. Maybe you should also change tcp_retries1?
Is it possible to change the Retransmission Timeout (RTO)?

Also I looked at Kernel documentation, file ip-sysctl.txt and I got:

tcp_retries1 - INTEGER
This value influences the time, after which TCP decides, that
something is wrong due to unacknowledged RTO retransmissions,
and reports this suspicion to the network layer.
See tcp_retries2 for more details.
RFC 1122 recommends at least 3 retransmissions, which is the
default.

tcp_retries2 - INTEGER
This value influences the timeout of an alive TCP connection,
when RTO retransmissions remain unacknowledged.
Given a value of N, a hypothetical TCP connection following
exponential backoff with an initial RTO of TCP_RTO_MIN would
retransmit N times before killing the connection at the (N+1)th RTO.
The default value of 15 yields a hypothetical timeout of 924.6
seconds and is a lower bound for the effective timeout.
TCP will effectively time out at the first RTO which exceeds the
hypothetical timeout.
RFC 1122 recommends at least 100 seconds for the timeout,
which corresponds to a value of at least 8.

In other thread I read about socket option TCP_USER_TIMEOUT. I've never use it but it could be an easy solution.
Application control of TCP retransmission on Linux

I hope one of these options helps.

How to view/change socket connection timeout on Linux?

I think you want /proc/sys/net/ipv4/tcp_syn_retries. The default is usually 5 or 6 which comes out to around 3 minutes.

Note that these are system-wide.



Related Topics



Leave a reply



Submit