0

How many IP addresses could be assigned to one network interface at the same time? Are there any limits? Could user assign half of /8 subnet addresses to one interface and another half to another interface? Edit: I'm interested in Linux limits (if there are such).

3
  • 1
    If there is a limit, it would likely be depending on the specific operating system. Can you add which OS you are curious about? – mtak Mar 18 '19 at 10:02
  • Half a /8 is effectively a /9... which is ( 2 ^ (32 - 9) ) - 1 - 2 = 8,388,605 addresses... Are you sure you want to do that? – Attie Mar 18 '19 at 18:46
  • @Attie yes. I want to know if there are limits and if such - what happens when you assign more then limit. I'm thinking of IoT devices which runs Linux and has limited RAM capacity. – MrSnowMan Mar 18 '19 at 20:37
0

In Linux you are only limited by available memory as each IP address consumes an amount of bytes of RAM, though very small. The exact amount can vary from version to version of the Linux kernel, but it is in the order of magnitude of few tens of bytes for each address itself plus some ancillary data, so you should be ok with assigning an entire /8 of the IPv4 address space (not the IPv6 though!) on a 4GB RAM machine. As to assigning half /8 (i.e. a /9) to one interface and the other half to another interface, it makes no practical difference in terms of memory usage.

In any case don’t use an interface alias for each address, like the legacy ifconfig command would do, as that would increase the memory footprint quite a bit.

3
  • 1
    whoops! :-D nope, sorry, I meant tens of bytes. Thanks for notifying it – LL3 Mar 18 '19 at 18:47
  • Are you sure there isn't another limiting factor... for example is a 16-bit index used for the :0 suffix in eth0:0? – Attie Mar 18 '19 at 18:49
  • 1
    Well, the whole “eth0:x” syntax is actually an interface name, precisely an alias, and I did advice not to use aliases at all. However I think that would not be problem either. At the moment I cannot double-check that in kernel sources but as far as I remember the interface names are strings 15-bytes long, and as such there could be room for billions of “indexes”. – LL3 Mar 18 '19 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.