Use Jail virtual multiple server hosts

xiaoxiao2021-03-06  106

Use Jail virtual multiple server hosts

HD

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.

Long preparation

1.1. Make World First You need to prepare a "original" operating system, which is simple, which is to generate a new one, 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 destdir = / 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 / HDTEST / STAND

CP / Stand / Sysinstall / Home / Jail / HDTEST / Stand /

Cp /etc/resolv.conf / home / jail / hdte / 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, so some Dongdong use it)

• Settings in NETWORK? Inetd

? Sendmail

? Startup

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.

Note: Any reprint or excerned, please retain the author information and indicate the article (Chinese FreeBSD user group http://www.cnfug.org)

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

New Post(0)