ablog

不器用で落着きのない技術者のメモ

Linux で設定可能な仮想IPアドレスの最大数

Linux 2.2 <= は 255 と言う制約があったが、Linux 2.2 < は制約ない。実装が linked list に変わったため。

Issue

How many network interfaces aliases does Red Hat Enterprise Linux support?
What is the maximum number of interface aliases I can use on Red Hat Enterprise Linux?

Resolution

There is no practical limit.

Root Cause

In Linux kernel 2.2 there was a limit of 255 interfaces.
In modern Linux kernels, interfaces and IP addresses are implemented as a linked list, removing any hard limit of these items.
You can add IP addresses until you run out of system RAM from allocating the (very tiny) kernel data structures. This is kernel function __inet_insert_ifa()

What is the maximum number of interface aliases supported in Red Hat Enterprise Linux? - Red Hat Customer Portal

仮想IPアドレスという呼び方は正確ではなく IP エイリアスというのが正しいと思うが、日本のIT業界で「仮想IP」という呼び方をされていることが多い気がするので、こういうタイトルにしてみた。
知らんけど。

IP-aliases are an obsolete way to manage multiple IP-addresses/masks per interface. Newer tools such as iproute2 support multiple address/prefixes per interface, but aliases are still supported for backwards compatibility.

IP-Aliasing — The Linux Kernel documentation