Use Jail virtual multiple server hosts

zhaozj2021-02-16  64

It has been used for many years using FreeBSD. FreeBSD is always surprising. Just here we have to talk about JAI, exactly a truly virtual "host" service that freebsd starts in the 4.x version. JAIL is like many small machine servers, which allows us to install a host operating system first, and all other running operating systems are installed on this host operating system platform.

This paper mainly describes the use of Jail for FreeBSD 5.0. Since FreeBSD 5.0 ​​is a lot of changes, you can use Jail on 4.x which you might need to check the relevant information. You can also contact the author hd@huangdong.com discussion.

1. Long preparation 1.1. Make world

First you need to prepare a "original" operating system, the principle is very simple, that is, using the functionality of Make World to generate a new, but the installation target path is not / a complete operating system. This step will take a long time. Everyone must have an idea, in my P III 450 / 128m notebook for nearly 4 hours.

My installation target path is / home / jail / hdtest, if you need to put your virtual host in other paths, you need to change this path.

Mkdir -P / Home / Jail / HDTEST CD / USR / SRC Make World Desdir = / Home / Jail / HDTest

If you have already made it world, you can use the following command to make your make world speed.

Make installworld destdir = / home / jail / hdtest cd etc Make distribution destdir = / home / jail / hdtest

1.2. Preparation before starting

For the new system configuration, it is best to install a sysinstall, which can be easily initialized by it. In fact, this is an Option, if you are familiar with you can generate a configuration file.

Mkdir / Home / Jail / HDTESTALL / HOME / JAIL / HDTEST / STAND / CP /ETC/Resolv.conf / Home / Jail / HDTEST / ETC Touch / Home / Jail / HDTEST / ETC / FSTAB

Also, you need to prepare an IP address for Vhost, this is the settings I am in /etc/rc.conf:

Ifconfig_fxp0_alias0 = "INet 192.168.10.60 Netmask 255.255.255.255"

2. Enter the virtual world 2.1. Start Jail's shell

We need to get a Jail's shell to configure configuration files in this VHOST.

Jail / home / jail / hdtest jail.huangdongdong.com 192.168.10.60 / bin / sh

Here Jail.huangdong.com is your hostname, 192.168.10.60 is your IP address, this IP address should have been bound to your network card using Alias ​​parameters. The last / bin / sh is the shell running after running.

2.2. System configuration

In fact, for the configuration in vhost is similar to the configuration of the installation of the server. However, the settings for the network can be done again. Enter the config in sysinstall, set up the next pair (my habits, for reference only):

Console Time Zone (must set it, good east) Setting inetd sendmail Startup in NetWork

Another is to configure your /etc/ssh/sshd.conf, set the listenAddress to the IP address of Vhost. Note that at this time, there is no real starting the vhost system, you just use it for a shell. 2.3. Start system

First, you need your mount a procfs Mount Point to vhost.

Mount -T Procfs Proc / Home / Jail / Test / Proc

Let's start this vhost.

Jail / Home / Jail / Test Jail.huangdong.com 192.168.10.60 / bin / sh / etc / rc

Next, you can see a series of startup information.

转载请注明原文地址:https://www.9cbs.com/read-12762.html

New Post(0)