How many IPs can I configure on Linux system on one NIC ??

If its different for freeBSD, Fedora and RedHat Linux then whats the exact figures for each ....

Dani AI

Generated

Short answer: there’s no small, distro‑specific hard cap — modern Linux and FreeBSD both allow many addresses on a single physical interface. Linux no longer needs the old “eth0:1” alias trick; that aliasing is a legacy naming convenience and the recommended workflow is to use iproute2 (the ip command) to add multiple addresses to the same device. (docs.kernel.org)

FreeBSD: the handbook explicitly states an interface has one primary address and may have any number of alias addresses (aliases in rc.conf are processed sequentially until a missing index is found; newer rc.conf syntaxes such as the ipv4_addrs options are also available). That makes FreeBSD behaviour functionally the same goal as Linux — many addresses per NIC, limited by system resources and config details rather than a tiny hard limit. (docs-archive.freebsd.org)

History note tied to the thread: ’s recollection about a kernel tunable comes from old 2.0‑era code where a NET_CORE_NET_ALIAS_MAX sysctl existed (that’s why people quoted a default like 256 back then). modern kernels document aliasing as obsolete and you typically will not find that proc knob on current kernels — so treat that historical number as legacy trivia, not a present distro quota. Also, and were correct in practice: aliases let one physical NIC answer on multiple subnets, but the implementation and recommended tools have changed. (nic.funet.fi)

Practical guidance (apply immediately): add addresses temporarily with ip and inspect with ip — for example:

# add temporarily
ip addr add 198.51.100.5/24 dev eth0

# list addresses
ip addr show dev eth0

Make configurations persistent with your distro’s network tool (NetworkManager / nmcli on modern Fedora/RHEL, systemd‑networkd, or the distro’s legacy scripts). If many addresses are used on the same broadcast domain, tune Linux ARP behavior to avoid “ARP flux” (sysctls like arp_filter, arp_ignore and arp_announce) and watch neighbor/ARP tables and NIC/driver limits. Real‑world reports show hundreds (even thousands) of addresses used on single interfaces; plan for kernel/driver resource use and test. (docs.redhat.com)

References used above: kernel docs on aliasing and ip address handling, FreeBSD Handbook, old kernel sysctl definition, RHEL/NM docs, and ARP/sysctl guidance.

Recommended Answers

All 6 Replies

That's actually a tough question to answer. I can tell you, though, that Fedora and RedHat will likely be the same. You will probably have to manually configure them via the ifconfig command, rather than using the GUI tools, as they usually only support one address per interface.

I tried going through the source code for both FreeBSD and Linux, but really didn't find a way to go. Perhaps this would be a great question to pose to each the Linux and FreeBSD kernel developers' Network mailing lists?

I tried going through the source code for both FreeBSD and Linux, but really didn't find a way to go. Perhaps this would be a great question to pose to each the Linux and FreeBSD kernel developers' Network mailing lists?

You'd want to use the 'alias' command with ifconfig, as described in the FreeBSD Handbook. You set this in /etc/rc.conf

Example:

alias_fxp0="inet 10.0.3.4 netmask 255.255.255.0"

How many IPs can I configure on Linux system on one NIC ??

If its different for freeBSD, Fedora and RedHat Linux then whats the exact figures for each ....

Here's how we do it where I work. Just set up an alias for the ethernet port you want to apply multiple IP addresses to. Theoretically you could apply as many IP addresses to an ethernet port as you want. We typically have never used more than 4. We're also using RedHat Enterprise Linux Server v3/v4.

[ifcfg-eth1]
DEVICE=eth1
BOOTPROTO=none
HWADDR=00:D0:B7:4D:50:ED
ONBOOT=yes
USERCTL=no
PEERDNS=yes
TYPE=Ethernet
IPADDR=
NETMASK=
NETWORK=
BROADCAST=
GATEWAY=

[ifcfg-eth1:1]
DEVICE=eth1:1
BOOTPROTO=none
ONBOOT=yes
IPADDR=
NETMASK=
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=
TYPE=Ethernet

These files are located in /etc/sysconfig/network-scripts. Configuring these through the GUI utilities will work almost as well as manually editing the files yourself.

Hope this helps.

Here's how we do it where I work. Just set up an alias for the ethernet port you want to apply multiple IP addresses to. Theoretically you could apply as many IP addresses to an ethernet port as you want. We typically have never used more than 4. We're also using RedHat Enterprise Linux Server v3/v4.

[ifcfg-eth1]
DEVICE=eth1
BOOTPROTO=none
HWADDR=00:D0:B7:4D:50:ED
ONBOOT=yes
USERCTL=no
PEERDNS=yes
TYPE=Ethernet
IPADDR=
NETMASK=
NETWORK=
BROADCAST=
GATEWAY=

[ifcfg-eth1:1]
DEVICE=eth1:1
BOOTPROTO=none
ONBOOT=yes
IPADDR=
NETMASK=
USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=
TYPE=Ethernet

These files are located in /etc/sysconfig/network-scripts. Configuring these through the GUI utilities will work almost as well as manually editing the files yourself.

Hope this helps.

And thats why I was asking ... how many aliases like these can I make in Linux?

And thats why I was asking ... how many aliases like these can I make in Linux?

Ok... here's what I have on the maximum number of IP aliases. According to my documentation, as of Linux kernel 2.0.3 and up the default maximum number of aliases is 256. This can be changed by updating or creating this file and putting the new maximum number...

/proc/sys/net/core/net_aliax_max

Does that answer your question?

One of the things not pointed out here was the ability of the alias
to exist on more than one subnet. Meaning eth0 is the first and eth:1
the second in traditionial fashion. This comes in really handy when merging
domains or for load balancing applications such as Oracle.

In the most basic sence, you can really name it anything as long as
the mac addresses are bound to the correct common device. You can
even go as far as to edit the scripts and files by hand in
/etc/sysconfig/network*.

just copy the initial eth0 files to the new name and edit appropriately.

after:

ifup eth0:1

or the like or simply:
service network restart

you can also use miitool or the current version, ethtool
to set persistant forced speeds, duplexing and whatnot.

gotta love it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.