Ephemeral Port 是自動配置的近端 IP L4 通訊埠 (local port),作為當下通訊暫時使用。
ephemeral:無常的、短命的、短暫的
IANA 建議範圍 49152 ~ 65535,Linux 使用 32768 ~ 60999,可用
echo "49152 65535" > /proc/sys/net/ipv4/ip_local_port_range
更改範圍,實際上是存在陣列 sysctl_local_port_range 的兩個數字。
如何配置?
bind() 指定 local port
inet_hash_connect() @net/ipv4/inet_hashtables.c:
inet6_hash_connect() @net/ipv6/inet6_hashtables.c:local port 未指定時,範圍內從小到大...
__udp_lib_get_port() @net/ipv4/udp.c
inet_csk_get_port() @net/ipv4/inet_connection_sock.c
selinux_socket_bind() @security/selinux/hooks.c:不在範圍內時 ...
問題:
可針對不同 net_device 而有不同範圍?
最後更新:20200721
沒有留言:
張貼留言