How I set up proxmox

My virtual machines typically need both a public port that is forwarded to the machine, for instance a SSH port. One could argue that not many machines should really require direct access, but I don't care.

1) Choose the Proxmox-VE (the host)

2) Choose Network

3) Then edit the "vmbr0" bridge. And configure it like below.


4) Make sure your virtual machines also have their network card changed to use vmbr0

if you're using OpenVZ it has to look like this:



5) Shutdown all virtual machines and reboot the host. (you can probably avoid this and still enable the interface, but I like to see that everything boots up)

6) Remember to set up the IP on the virtual machine, for instance by editing /etc/network/interfaces.




Connecting to your virtual machines


The easiest way to get started administrating your machines is by establishing a port forward over SSH from your local workstation.

(Run on local machine)
ssh root@5.5.5.5 -L 5522:10.0.0.10:22

Where:
5.5.5.5 is the proxmox host
10.0.0.10 is the internal client

5522 is just a number I came up with for the local port, but could be something else.

After this you can open another SSH on your local machine and connect to the virtual machine:
ssh yourvirtualuser@localhost -p 5522


Potential error scenarios:
"channel 3: open failed: connect failed: No route to host"
This means that the host cannot route to the virtual machine. You need to find out what this is, but most likely the host server and the virtual machine do not have an IP on the same subnet.

Connecting the virtual machine to the Internet
It still isn't possible for the virtual machine to connect to the internet even though the virtual machine uses the host as gateway, and the gateway has it's IP configured.

What we need to do is configure the host to do NAT and IP forwarding.

Login to host via SSH and add the last 3 lines concerning ip forwarding and NAT:


vim /etc/network/interfaces

auto vmbr1
iface vmbr1 inet static
        address  10.10.11.1
        netmask  255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o eth0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o eth0 -j MASQUERADE

4) Reboot host












Comments

Popular posts from this blog

Switching from Docker Desktop to Rancher Desktop on WSL2: Solving the Missing docker-credential-desktop.exe Error

Running LXD/LXC on WSL2 with Ubuntu 20.04

Proxmox Remote administration via VNC