Proxmox - Route extra IPs to KVMs

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
linuxlove07
New to forums
New to forums
Posts: 2
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Dec 14, 2022 6:35 pm

Proxmox - Route extra IPs to KVMs

Post by linuxlove07 »

Hello!


I've just picked up a full machine with 10 extra IP addresses on the side. I've noticed that I am not going to be able to route these IPs like I had originally intended and thought. Being that some of the IPs I've been given share different gateways. How would one go about setting up the proper networking to allow the VMs to utilize the extra IP space I have acquired for them.

Would I have to add the IPs to the actual host system and then use iptables to forward traffic to their respective VMs? Am I gonna have to revisit this idea entirely?

I have always used bridged setups on proxmox with the ability to add MACs to IPs (such as OVHCloud, for example), I have not attempted something this radical before. I wanted to reach out before attempting anything drastic and risk losing the entire setup (been there done that already).


I appreciate any and all input on the subject. :D
User avatar
TimeX
Staff
Staff
Posts: 1730
Joined: Thu Jul 22, 2004 12:24 am
Location: Big Bear, CA

Re: Proxmox - Route extra IPs to KVMs

Post by TimeX »

I'm not familiar with the software you are using, but with how our network is configured on our end, you should be able to use the gateway for the first IP for all the other IPs. The different IP blocks don't specifically need their individual gateway IPs. Have you attempted this yet using the same gateway for them all, and would that solve the situation for you?
TimeX
linuxlove07
New to forums
New to forums
Posts: 2
Joined: Wed Dec 14, 2022 6:35 pm

Re: Proxmox - Route extra IPs to KVMs

Post by linuxlove07 »

I have not attempted anything just yet. I wanted to actually formulate a *working* plan on paper before I attempted anything and risked breaking the server again. To my understanding, I would not be able to use a bridged networking approach because the VMs would then have different MAC addresses compared to the host machine. In the Proxmox VE configuration it states that most networks do not allow this kind of setup, so I assume this is the case here.


Which means I would need to take a routed approach instead, I'm not sure how I can achieve this due to the IPs being completely different in ranges. I don't know how I can assign more than 1 IP address to a VM bridge interface, to my understanding you cannot do this.

So this brings me to my other possible workaround. Assigning the IPs to the host machine as you would normally following the forum tutorial that has been posted here. Then using iptables to masquerade and route the traffic to and from the VMs.


Unfortunately, I am not very well versed in doing routed setups like this as I've usually had the luxury of assigning virtual MACs to IP addresses and having them function as their own physical devices on the network.
User avatar
TimeX
Staff
Staff
Posts: 1730
Joined: Thu Jul 22, 2004 12:24 am
Location: Big Bear, CA

Re: Proxmox - Route extra IPs to KVMs

Post by TimeX »

If you have several IPs, you could use just a couple of them to test different configurations to see if it works or not. If it breaks something, you would have your other IPs you can use to connect still. Just make sure you leave 1-2 IPs working that you will not be testing with.

I'm honestly not sure if virtual mac addresses would work or not. IPs are assigned manually, not by automatic configuration, so I wouldn't expect a change in mac address to cause a problem there. Admittedly, I'm not as well versed on the back end network configuration as some others.
TimeX
Post Reply