Assigning Public IP to LXC and VM

clouddata

Member
Oct 14, 2020
1
0
6
43
Hi, I know this topic maybe has been mentioned before but I cannot find a solution that works for my configuration.

I got a /24 from ARIN, so made a Proxmox HA cluster with 4 nodes, I have my VMs working fine in my private network and i just made a 1:1 NAT in my router to have a public IPs in each machine. I'm using the first 50 IPs so i decided to sell VPS with the remaining 200, so i tried to test setting up LXC containers with one of my public IPs with a /32 subnet so they cannot see my private network and also customers cannot see each other, but I haven't be able to have internet access on the LXC containers with the public IPs.

My configuration is the following (ip's are not real for security purpose):
Router Private Address: 192.168.1.1
Public IP Block: 50.77.122.0/24
Public Gateway: 50.77.122.1
Addresses from 192.168.1.10 to 192.168.1.50 are 1:1 NAT in the edgerouter to (50.77.122.10 to 50.77.122.50) for my personal use

Network interfaces for each node
eno1 - 192.168.1.0/23 - Production Network set with vmbr0
eno2 - 10.0.0.0/24 - Cluster Network
ens1f0 - 10.1.0.0/24 - Ceph Network
ens1f1 - 50.77.122.0/24 - Network for public VPS (vmbr1)

Now, node-4 is free so I'm testing with that one, i made the bridge "vmbr1" and config details are below:

Code:
auto lo

iface lo inet loopback


auto eno1

iface eno1 inet manual


auto eno2

iface eno2 inet static

        address 10.0.0.4/24


auto ens2f0

iface ens2f0 inet manual


auto ens2f1

iface ens2f1 inet manual


auto bond0

iface bond0 inet static

        address 10.1.0.4/24

        bond-slaves ens2f0

        bond-miimon 100

        bond-mode 802.3ad


auto vmbr0

iface vmbr0 inet static

        address 192.168.1.14/23

        gateway 192.168.1.1

        bridge-ports eno1

        bridge-stp off

        bridge-fd 0


auto vmbr1

iface vmbr1 inet static

        address 50.77.122.5

        netmask 255.255.255.0

        bridge-ports ens2f1

        bridge-stp off

        bridge-fd 0

#up route add -net 50.77.122.0 netmask 255.255.255.0 gw 50.77.122.1 dev vmbr1 ****This Line is commented because gives me an error when i raise the network

        up ip route add 50.77.122.51/32 dev vmbr1




Then i made an LXC with ubuntu and i set as ip 50.77.122.51 and gateway 50.77.122.5 (node4), dns 8.8.8.8 but i have no internet in the container.

Can someone please tell me what i'm doing wrong here?
 
Hi,

you need no IP on the vmbr1. A vmbr is a switch and work without IP.
I guess the main problem here is the route in the container. Normally the gateway is part of the network subnet.
So check the routes in the CT.
 
Hello,

I have the following:

Code:
iface eno2 inet manual

auto vmbr10
iface vmbr10 inet manual
        bridge_ports eno2
        bridge_stp off
        bridge_fd 0

attach vmbr10 to vm/ct and set the static ip ( supposing that you have multiple ip's available )
 

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!