johnpoint

johnpoint

(。・∀・)ノ゙嗨
github

Exploring Proxmox VE

I have always been curious about how hosting providers divide a dedicated server into VPS for sale. So I decided to play around with Proxmox VE these days.

image

Environment#

  • Ubuntu 18.04.2 Desktop Edition
  • VirtualBox Graphical User Interface Version 5.2.18_Ubuntu r123745
  • Proxmox-ve_5.3-2

Installation#

Since I didn't have any spare machines at hand, I reached out to my laptop and created a virtual machine on it, allocating 4GB of memory and a 50GB hard drive to it. During the installation, I downloaded the Proxmox VE 5.3 ISO Installer ISO image from the official website and installed it just like any other operating system, completely foolproof.

After the installation is complete, you will be prompted to log in and given a web address, just like this

image

But since we are using a virtual machine, we need to configure port forwarding in Settings->Network->Adapter 1->Advanced->Port Forwarding

Then, access the panel in your browser using https://127.0.0.1:forwarded_port. You will be able to see the panel.

image

Usage#

In the upper right corner of the panel, there are buttons for [Create VM] and [Create CT], which correspond to the virtualization technologies KVM and OpenVZ (LXC?).

Image Download#

KVM#

Simply download the official installation image and place the image in

/var/lib/vz/template/iso

OpenVZ#

You need to download it from the download page on the OpenVZ official website.

The placement directory is

/var/lib/vz/template/cache

Network Card & NAT#

Since I am running a virtual machine within a virtual machine and do not have a public IP address, we need to use NAT (Network Address Translation) to forward traffic, otherwise it would be a single-player game.

Host Configuration#

Edit the file /etc/network/interfaces and add

auto vmbr2
iface vmbr4 inet static
        address  10.97.0.254
        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.97.0.0/24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.97.0.0/24' -o vmbr0 -j MASQUERADE
        post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 1024 -j DNAT --to 10.97.0.1:22
        post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 1024 -j DNAT --to 10.97.0.1:22

Then execute /etc/init.d/networking restart

This will add a network card, which is mainly used for forwarding traffic for the following virtual machines. It will redirect all traffic to the host's network card that can connect to the external network.

Virtual Machine Configuration#

image

Just follow the information above and adapt accordingly (?) The network manager should fill in the IP address of the host.

Tips:#

  • The configuration here is mainly for creating CT containers. KVM may be added in the future (TBD)
  • There seems to be a problem with the CentOS 7 OpenVZ image, and it is impossible to enter the correct password.

Finally#

I have set up three servers~

image

References#

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.