Multiple addresses on single ethernet adapter

Sometimes multiple IP addresses are required (either for test or to really separate communication channel of applications). If a setup is expected to span on multiple computers, but the proof of concet or initial testing is performed a single PC, then multiple IPs for same PC is usually chosen (besides multiple complete VMs or containers).

The easiest approach is usually to add another network adapter (ethernet or WiFi), but if there are no free slots on the computer or no free ethernet ports, or spare cables, or something else, then the fastest approach is to add another IP to existing network adapter.

Although it is uncommon and unfamiliar for most Windows users, it is fairly easy to be performed via the GUI.

As seen on the following screenshots, if the default DHCP is enabled, then the secondary IP option is not available (follow the numbers to reach to the menu).

If the IP is manually set, then the advanced options offer more flexibility and second, third, etc. IP can be added (second screenshot and forth screenshot, where also the result from ipconfig /all is listed).

The third screenshot is example of applicability- to enable IIS to listen on multiple IPs with the possibility to have one page on one IP and another on another IP (for example when changing port is not viable or server name indication (SNI) can not be used). So for example internet facing page and test page can be on same server, but having different (or same) content.

The same can be done also for Linux computers, but as with most Linux settings, this is easiest doen by simply modifying several files via text editor (not necessary nano 😉 )

The network interface configuration is usually under /etc/network/interfaces (or at least there is a good starting position). Add suffix to the adapter and bring the adapter up (set it to auto and restart or bring it up from bash). Also here multiple IPs can be set up for same adapter (last of the above screnshots).

The Apache web server can be set up to provide different pages on different IP addresses. Some examples can be found in the official Apache documentation.

When multiple hardware adapters are present on a hypervisor, then there are endless possibilities to combine the virtual machines’s connectivity- directly exposing hardware adapter to VM, setting up multiple virtual adapters and possibility to set up multiple IPs on virtual adapter… it can become quite a spageti bowl.

lia lia lia ... so much fun to add advertisement after the post