- 追加された行はこのように表示されます。
- 削除された行は
このように表示されます。
!!FreebSD jail で vnet を使う
普通のjailは
*FB-jail
----
!jail.conf
################
## jail01
## mdconfig -a -t vnode -f /home/JAIL/aaa_swap0 -u 11
vnet = "new";
aaa
{
jid=11;
## name=ss11;
path=/home/JAIL/aaa;
## ip4.addr=192.168.12.56;
## ip4.addr=192.168.16.242;
host.hostname=squid.jail.green.local;
allow.chflags;
allow.raw_sockets;
exec.start="/bin/sh /etc/rc";
exec.stop="/bin/sh /etc/rc.shutdown";
# interface=igb0;
# interface=bnxt0;
## interface=em0;
vnet.interface=epair1b;
mount.devfs;
devfs_ruleset=4;
}
## b
# mdconfig -a -t vnode -f /home/JAIL/bbb_swap0 -u 22
bbbbbb
{
jid=22;
path=/home/JAIL/bbb;
## swap=/home/JAIL/bbb_swap0;
## ip4.addr=192.168.12.57;
## ip4.addr=192.168.12.56;
## ip4.addr=192.168.16.242;
host.hostname=stest.jail.green.local;
allow.chflags;
allow.raw_sockets;
exec.start="/bin/sh /etc/rc";
exec.stop="/bin/sh /etc/rc.shutdown";
# interface=igb0;
# interface=bnxt0;
# interface=em0;
# interface=epair2b;
vnet.interface=epair2b;
## vnet.interface += "epair102b";
mount.devfs;
devfs_ruleset=4;
}
##
----
!vnet00.sh
## ifconfig epair0a destroy
ifconfig epair1a destroy
ifconfig epair2a destroy
#
ifconfig bridge0 destroy
#
# epairデバイス作成
## ifconfig epair0 create
ifconfig epair1 create
ifconfig epair2 create
# ホスト側でブリッジインターフェイス作成
ifconfig bridge0 create
## ifconfig bridge0 addm epair0a addm epair1a addm epair2a addm igb1 up
## ifconfig bridge0 inet 192.168.1.254/24 up
ifconfig bridge0 addm epair1a addm epair2a addm em0 up
ifconfig bridge0 inet 192.168.200.250/24 up
# VNET 起動
# jls
# JID IP Address Hostname Path
# 11 192.168.12.56 pri1.jail.green.local /home/JAIL/aaa
# 22 pri2.jail.green.local /home/JAIL/bbb
#
ifconfig epair1a up
ifconfig epair2a up
##
echo "11"
ifconfig epair1b vnet 11
jexec 11 ifconfig epair1b up
jexec 11 ifconfig epair1b inet 192.168.200.11/24 up
echo "22"
ifconfig epair2b vnet 22
jexec 22 ifconfig epair2b up
jexec 22 ifconfig epair2b inet 192.168.200.22/24 up
##
##
##
## ifconfig epair0a destroy
ifconfig epair1a destroy
ifconfig epair2a destroy
#
ifconfig bridge0 destroy
#
# epairデバイス作成
## ifconfig epair0 create
ifconfig epair1 create
ifconfig epair2 create
# ホスト側でブリッジインターフェイス作成
ifconfig bridge0 create
## ifconfig bridge0 addm epair0a addm epair1a addm epair2a addm igb1 up
## ifconfig bridge0 inet 192.168.1.254/24 up
ifconfig bridge0 addm epair1a addm epair2a addm em0 up
ifconfig bridge0 inet 192.168.200.250/24 up
# VNET 起動
# jls
# JID IP Address Hostname Path
# 11 192.168.12.56 pri1.jail.green.local /home/JAIL/aaa
# 22 pri2.jail.green.local /home/JAIL/bbb
#
ifconfig epair1a up
ifconfig epair2a up
##
echo "11"
ifconfig epair1b vnet 11
jexec 11 ifconfig epair1b up
jexec 11 ifconfig epair1b inet 192.168.200.11/24 up
echo "22"
ifconfig epair2b vnet 22
jexec 22 ifconfig epair2b up
jexec 22 ifconfig epair2b inet 192.168.200.22/24 up
##
##
##