Public IPs for each KVM/LXC

TheH2SO4

New Member
Jul 6, 2022
13
0
1
Hi there! I'm just literally new to proxmox and I have been using it for a couple of days now. I bought a ProLiant DL360p Gen 8 to start and a TL-SF1005D to start running my home lab.

I have been reading a lot about this topic on the forum, but I haven't really found anything clear about how to assign a public IP to each VM, the problem is that when I create a KVM/LXC machine and I pick DHCP to assign IPv4 and IPv6 automatically, okay that's fine but if I create another KVM/LXC with the same network configuration with DHCP it gets the same public IP as the first VM.

So if anyone could actually be kind and help me as I have been reading and searching about it for the past 2 weeks or so. (I got the server the 29 of june)

Here's my network configuration by the way:

Screenshot 2022-07-23 133410.png
 
Last edited:
This should probably be labeled as a question or help and not a tutorial.

I assume the lxc are using 192.168.0.1 as the dhcp server? Does each LXC have a different MAC address under datacenter/nodes/mephisto/<containerid>/network/net*?
 
  • Like
Reactions: TheH2SO4
This should probably be labeled as a question or help and not a tutorial.

I assume the lxc are using 192.168.0.1 as the dhcp server? Does each LXC have a different MAC address under datacenter/nodes/mephisto/<containerid>/network/net*?
They actually have different MAC adresses, I've just created 2 LXC machines and selecting DHCP as above and:

LXC 1:

a.png

LXC 2:

e.png

As you can see where it says IP address it just says "dhcp" so I cannot tell if the LXCs machines are using 192.168.0.1 as a DHCP server, but I think so. - Thanks for reply :)
 
so what/where is 192.168.0.1? from a router you own or your ISP?

If that's the IP of your router can you look at the dhcp leases there and see if the 2 MAC address' above show up?
 
Last edited:
so what/where is 192.168.0.1? from a router you own or your ISP?

If that's the IP of your router can you look at the dhcp leases there and see if the 2 MAC address' above show up?
192.168.0.1 is actually from my router.

WhatsApp Image 2022-07-23 at 5.19.58 PM.jpeg

Sorry I just used fing in my phone to check. I also checked bot LXC cointainers and yes, they both have the same public IP address.
 
Oh sorry, gotcha now. Is there a reason you want to directly expose those LXC to the internet and all the bad actors out there? I set up a self-hosted WireGuard VPN to get access to my internal network, but maybe you have different needs.
 
  • Like
Reactions: TheH2SO4
Oh sorry, gotcha now. Is there a reason you want to directly expose those LXC to the internet and all the bad actors out there? I set up a self-hosted WireGuard VPN to get access to my internal network, but maybe you have different needs.
Oh, I actually need to do it due to game servers purposes and so I would like to have different public IPs on each LXC/KVM machine. I use Tailscale to access to the Web UI outside the network.
 
Last edited:
You can try the 3.3.5. Routed Configuration under the linked below using your ISP granted /29 block.

3.3. Network Configuration
Sorry this is maybe a silly question but, would that configuration help me to have a public IP for each VM? Because I thought I had to separate the traffic in order to do so and not routing all traffic via a single interface. I am glad to try anyway.
 
Last edited:
the graphic from that page suggest it should work with a public IP for each LXC/VM, but yes all traffic will be proxied through eno1 with replicating that setup. Obviously susbtitute your public ***.***.***.***/29 addresses for the public ip example 203.0.113.16/28 used below.

default-network-setup-routed.svg


Seems your Proxmox host has 4 interfaces, eno1...4. Does your router have multiple ports as well? if so maybe it would easier/more efficient to utilize all the available router ports and with separate cables between the Proxmox host and your router. this would give your router different MAC address at each connection. Then set up a vmbr1 for each eno1...4 and give each LXC needing a public IP one of those VMBR.
 
the graphic from that page suggest it should work with a public IP for each LXC/VM, but yes all traffic will be proxied through eno1 with replicating that setup. Obviously susbtitute your public ***.***.***.***/29 addresses for the public ip example 203.0.113.16/28 used below.

default-network-setup-routed.svg


Seems your Proxmox host has 4 interfaces, eno1...4. Does your router have multiple ports as well? if so maybe it would easier/more efficient to utilize all the available router ports and with separate cables between the Proxmox host and your router. this would give your router different MAC address at each connection. Then set up a vmbr1 for each eno1...4 and give each LXC needing a public IP one of those VMBR.
I actually have 4 NICs on my server and I am using a switch/hub an ethernet cable is going from the router to the switch/hub and then I have two ethernets cables one going to eno1 and the other one going to eno2. Eno2 is activated and I created a linux bridge this morning which is vmbr1 which is using eno2.

How do I actually get the /28 block? Like I think the /29 is the public IP address that the KVM/LXC machines are using right now, but is only 1 IP address and not 2. Sorry I am extremely new to proxmox and networking, but I think I need to do a bit of research to just get the /28 block from my ISP.
 
It's at first difficult for sure. Mostly correct on your assumption. Having a /29 means you have a total 6 usable public IP address' given to you by your ISP. The current public IP they Proxmox and the LXC are all sharing can be assumed to be the first of those Public IP numbers. that would be substituted where 203.0.113.17 is in the graphic above, then you would have 5 more sequentially increasing IP numbers available to you for your LXC so (current public IP + 1) for Game LXC 1 and (current public IP + 2) for LXC 2.
 
It's at first difficult for sure. Mostly correct on your assumption. Having a /29 means you have a total 6 usable public IP address' given to you by your ISP. The current public IP they Proxmox and the LXC are all sharing can be assumed to be the first of those Public IP numbers. that would be substituted where 203.0.113.17 is in the graphic above, then you would have 5 more sequentially increasing IP numbers available to you for your LXC so (current public IP + 1) for Game LXC 1 and (current public IP + 2) for LXC 2.
So to find the /28 block I need to take a look at my ISP? For example: https://ipinfo.io/AS201838

As far as I understand the IP that I have now is the /29 which is a block provided by my ISP in which the block haves 6 IP adressess. But how do I find the /28 block then?

At my ISP /28 and /29 blocks appears to be for IPv6 and not IPv4. :(
 
Last edited:
yes you have it. in that case you can safely try to use 85.15.2.145/29 for vmbr0, 85.15.2.146/29 for game LXC1 and 85.15.2.147/29 for game LXC2.
 
Last edited:
  • Like
Reactions: TheH2SO4

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!