johnpoint

johnpoint

(。・∀・)ノ゙嗨
github

Exploring Proxmox VE

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

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 don't have any spare machines at hand, I reached out to my laptop with evil intentions and created a virtual machine on it. I allocated 4GB of memory and a 50GB hard drive to it. During 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. It was completely foolproof.

After installation, 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:mapped_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 it in

/var/lib/vz/template/iso

OpenVZ#

You need to download it from the OpenVZ official website's download page

Place it in the directory

/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 will be used for traffic forwarding for the following virtual machines. It will redirect all traffic to the host machine's network card that can connect to the external network.

Virtual Machine Configuration#

image

Follow the information above and adapt accordingly (?) The network manager should fill in the host machine's IP.

Tips:#

  • The configuration here mainly focuses on creating CT containers. KVM may be covered in the future (to be continued)
  • There seems to be a problem with the CentOS 7 OpenVZ image. 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.