VMware Cloud Community
LukeM_02
Contributor
Contributor

Multiple IP Addresses for 1 VM

Hi,

I want to configure multiple IP addresses to one Virtual Machine. I added an additional 2 Network Adapters, with the mac addresses all manually set.

When i login to the server, I can see that I have 3 IP’s:

IPv4 address for ens160: 148.251.XXX.XXX

IPv4 address for ens192: 148.251.XXX.XXX

IPv4 address for ens224: 148.251.XXX.XXX

 

The only IP address that is actually functional is ens224. None of the other IP’s respond to pings or anything and are unusable.

This is my netplan config, its just whatever the default was. 

I’ve searched for hours and cant really find any working info. I basically want to be able to use all 3 IP addresses, to access API’s and data cycling the IP addresses. 

Could anyone please provide me any information or pointers / guides as to what I should be changing to get this working? I am not a networking professional, so will need some good advise 🙂

 

 

 

0 Kudos
5 Replies
ThompsG
Virtuoso
Virtuoso

Hi @LukeM_02 and welcome to the room!

 

Before we start, maybe step back from the cliff 🙂 That's better, now to ask a few questions before leaping in.

 

Firstly, just trying to get a handle on what you are hoping to achieve with the 3 IP addresses? You mention accessing API and data cycling using all 3 IP addresses but I'm not sure this is going to work the way you expect. Without going too deeply, the networking stack in the guest machine will try to work out which interface has a path to the external resource and does this using the Default Gateway and Routes. 

 

It is best to just have 1 Default Gateway and you 'tie' this to a particular network adapter, so it acts like a path of last resort. Then you create routes so that other traffic goes over the other network adapters based on destination subnet/IP (yes lots of networking terms here).

 

Secondly, I noticed that you have created 3 network adapters for the 1 VM but they are all connected to the same vSwitch PortGroup (called Network in your screenshot). This appears to be using DHCP which has allocated an IP address to each interface which is likely adding to the confusion. One thing you can try if you would like 3 IPs but in the same network is to remove the extra 2 network adapters and then within the guest OS, change the IP allocation to static. Then you can two additional IP addresses to the same network adapter.

 

Hopefully I haven't misunderstood you or added to the confusion. If you attempt the second option, you should at least be able to confirm you can ping all 3 IP addresses to see that that is working.

 

Kind regards.

0 Kudos
LukeM_02
Contributor
Contributor

Hi @ThompsG . Gonna split this into 2 sections, one with my goal and what I want to achieve, and the second showing where I am currently.

1.) The Goal

I create applications for clients which access websites with restricted API's, as in allowing 100 requests per minute per API key. Recently a limit of 1000 requests per minute per IP Address was imposed. My applications all combined create more than this 1000 requests per minute limit, so I've essentially had to split the applications up across multiple servers using the various IP addresses I have purchased from Hetzner. I was recently told by another developer that it is possible to have multiple IP addresses attached to one server. This would then allow me to utilise these using software (Python) to make API requests using these multiple IP's to circumvent hitting the 1000 request per minute limit, and rather have a limit of say 5000 requests per minute (If i had 5 IP's attached)

2.) Where I Am

So i followed your advise, I removed the extra 2 NIC's. I even reinstalled ubuntu on the test machine just with 1 NIC to fix any configs that im not aware of back to system defaults. I then attempted (and I think sucessfully) changed the main IP ending in .248 to static. See my `ip a` screenshot: 

nb7gm

To  me this shows that I've got my main IP ending with .248 which is the one I use to connect to the server via SSH, as well as my .237 IP which is marked as secondary. These are now both on the same interface ens160. 

I can also locally ping .237 and it responds just fine. Heres a copy of my netplan config & `ip route show`:

rp43z 

LukeM_02_0-1703068515456.png

 

So now, the problem I have, is that IP ending with .237 is only accessible locally. I cannot access this externally, or ping it from the outside. This also means I cannot use it for my API Requests like I mentioned in PT 1.

Have I done this correctly, if so, what else do I need to do to allow this to access outside networks?

 

Just for reference, I am using EXSi 7.0 Update 2. I have multiple IPV4's available as I purchased them through Hetzner (the service provider) and I can request individual mac addresses for each IP. 

When configuring the other VM's I would typically make the NIC and have to manually input one of the IP's mac addresses to allow it to be able to access the internet using the IP. 

 

P.S I've also noticed that I cannot access anything, like the ubuntu resources when running apt get with my netplan config in static mode. So i've had to revert it back to DHCP. Although I can SSH / FTP into it, and ping 8.8.8.8 etc

0 Kudos
LukeM_02
Contributor
Contributor

Bump

0 Kudos
louyo
Virtuoso
Virtuoso

I have not done this, but my WAG would be that you need a separate MAC address for each IP address. Routers tend to use mac addresses for routing. If you use Wireshark, you will see "who has"  messages. I have seen people using the ip command to add a virtual MAC address to an ethernet device, but never done so. 

 

Lou

0 Kudos
bluefirestorm
Champion
Champion

Putting aside ESXi from the picture for the moment and at the risk of making things unnecessarily complicated, to achieve the goal possibly is to either use

NIC teaming/bonding or
Network load balancer (NLB)

With NIC teaming, there could be n IP addresses with the API Key request limit assigned to n NICs in the same machine (whether physical or virtual), configured in a NIC team/bonding in load balancing configuration and a team IP address without an API key limit. The n is therefore a minimum of 2. So client requests are routed to the team IP address (no request limit) and load balanced across n NICs with API key limits.

With NLB, instead of multiple NICs in a machine, there are multiple machines. Each has an IP address with the API key, and the NLB IP address configured is without the API key limit.

So if you have 4 IP addresses from Hetzner, 3 IP addresses could be used with an API key and 1 IP address to front the 3 IP addresses with API key request limits (whether for NIC teaming or NLB).

Whether NIC teaming is supported in VMware VMs, and whether NIC teaming or NLB will play nice with ESXi vSwitch and so on, it is another set of questions/issues.

Perhaps try first the NIC teaming/bonding with a virtual Intel 82574 ("e1000e" in vmx) which already looks like it is, based on 3-digit number after the ens (unless you used vmxnet3 instead of e1000e).

0 Kudos