Multi-node OpenStack Charms Deployment Guide 0.0.1.dev223-14--ssh port forwarding to solve the problem of bad international lines in IDC computer room

Reference documents:

An Illustrated Guide to SSH Tunnels
<Local image mirror (snap/2.9/UI)>

"MAAS+ubuntu private source environment setup"

The MAAS hosting is hosted in a third-party computer room, and found that the speed of accessing images.maas.io by Unicom in the office is slower than that of Unicom's single-line access. Even the images of charmhub and maas cannot be downloaded. After tossing, I found that it is possible to set up a www server in the LAN of the office network to install its own maas mirror source. The maas server accesses this intranet www server10.0.0.3 through ssh remote port forwarding to solve the maas mirror synchronization.

1 Install and configure maas local mirroring on server A on the company's intranet

Install simplestreams

sudo apt install simplestreams

First define some variables to organize the final CLI commands

KEYRING_FILE=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg
IMAGE_SRC=https://images.maas.io/ephemeral-v3/stable
IMAGE_DIR=/var/www/html/maas/images/ephemeral-v3/stable

The following example selects all available kernels compatible with Ubuntu 18.04 (Bionic) and Ubuntu 20.04 (Focal) for the amd64 architecture, thereby downloading approximately 3.1 GB of kernels. The second command mirrors the boot loader.

sudo sstream-mirror --keyring=$KEYRING_FILE $IMAGE_SRC $IMAGE_DIR \
    'arch=amd64' 'release~(bionic|focal)' --max=1 --progress
sudo sstream-mirror --keyring=$KEYRING_FILE $IMAGE_SRC $IMAGE_DIR \
    'os~(grub*|pxelinux)' --max=1 --progress

To know in advance what the sstream-mirror command will capture, or to avoid making wrong choices to save bandwidth and time, include the –dry-run option. If you are satisfied, delete the option to start the download.
MAAS will write the image to the disk in the directory defined by the variable "IMAGE_DIR" above, and the "location" of the new boot source will be

URL=http://10.0.0.3/maas/images/ephemeral-v3/stable/

Install apache2 to make the above URL effective.

apt-get install apache2

Check whether the Apache configuration file /etc/apache2/sites-available/000-default.conf is enabled in the directory /var/www/html/

DocumentRoot /var/www/html

Open the browser http://10.0.0.3/maas/images/ephemeral-v3/stable/to view the downloaded mirror cache, port 80

As shown below:
Insert picture description here

2 Use ssh remote port forwarding to enable MAAS server B 191.168.11.111 in the IDC computer room to access the intranet www server A 10.0.0.3:80

Execute the following ssh command from the internal network 10.0.0.3 host:

ssh -R 12345:10.0.0.3:80 -p 62022 [email protected] -N

The parameters are explained as follows:

-R is to enable remote port forwarding

12345:10.0.0.3:80 forwards the 12345 port of the remote host 191.168.11.111 to the port 80 of the intranet host 10.0.0.3.

-p 62022 [email protected], SSH access port 62022 of the remote host 191.168.11.111

-N Do not execute remote commands.

After the command is executed, you will be asked to enter the ssh password.

3 Synchronize custom mirroring with maas server

Select custom on the image page of the remote maas server, enter "http://localhost:12345/maas/images/ephemeral-v3/stable/" and
select connect, and various ubuntu versions will appear,
Insert picture description here
or execute maas cli on the maas server, It can be imported again.


After studying it again, it can be solved in a more simplified way:

1 Enable ssh remote port forwarding

From the intranet machine 10.0.1.3ssh to the maas server 191.168.11.111, enable remote port forwarding, so that the maas server can access images.maas.io through the ssh tunnel through the intranet machine 10.0.1.3.

Execute from 10.0.1.3.:
ssh -R 34567:images.maas.io:80 -p 62022 [email protected] -N

2 On the image page of the maas server server, enable custom image.

The content is written as:, http://localhost:34567/ephemeral-v3/stable/link, resynchronize.

Insert picture description here

The third method

Create a maas local mirror directly on the maas server.
The first method and the second method are combined, and it is estimated that everyone can solve it logically.

Guess you like

Origin blog.csdn.net/m0_49212388/article/details/114638121