Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 6 Next »

Setup VM with:

  • CPU - 4

  • Memory - 8GB

  • Hard disk - 100GB

  • Have to use DEBUG build, where we have debug macro

Create user:

sudo useradd -m -d /var/ztest -g staff -s /bin/bash ztest
# add password for remote ssh
sudo passwd ztest

Add user to sudo:

echo "ztest ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ztest

Install packages for net tests:

apt update
apt install system-test-nettest testrunner python

Login by user ztest and create zones:

Zones must be created according to the file:
/opt/net-tests/config/ip_forwarding.config
Currently accepted names: cz, sz, rz

Important! Zones must be in the / zones directory

Create dataset:

sudo zfs create -o mountpoint=/zones rpool/zones

Set network interfaces for dhcp

sudo dladm create-etherstub vsw0

sudo dladm create-vnic -l vsw0 int0

set config file interface /etc/hostname.int0

192.168.0.254 netmask 255.255.255.0 broadcast + up

reboot system

Set dhcp for zones

use this guide How to configure ISC DHCP server

Configure zones

The zone configuration should be considered for the cz zone, for other zones, the setting is the same:

cat>cz.cfg <<EOT
create
set zonepath=/zones/cz
set autoboot=true
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
sudo zonecfg -z cz -f cz.cfg

The zone configuration should be considered for the sz zone, for other zones, the setting is the same:

cat>sz.cfg <<EOT
create
set zonepath=/zones/sz
set autoboot=true
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
sudo zonecfg -z sz -f sz.cfg

The zone configuration should be considered for the rz zone, for other zones, the setting is the same:

cat>rz.cfg <<EOT
create
set zonepath=/zones/rz
set autoboot=true
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
sudo zonecfg -z rz -f rz.cfg

Install and run zones (example for zone cz):

sudo zoneadm -z cz install
sudo zoneadm -z cz boot

Install the socat package for every zone:

The zones have not configured net, need to install it from the global zone.

Download it in the global zone:

apt download socat

In the current version, the name of the downloaded file is socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

Install into the zones (example for zone cz):

sudo apt -y -o Dir=/zones/cz/root update
sudo apt -y -o Dir=/zones/cz/root upgrade
sudo dpkg -i --root=/zones/cz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

Launch tests:

sudo /opt/net-tests/bin/nettest

Wait for several minutes and have found full logs at:

/var/tmp/test_results/<ISO TIME>

Script for preparing the working environment of a network test

#!/bin/bash

apt install system-test-nettest testrunner python -y

sudo zfs create -o mountpoint=/zones rpool/zones


sudo dladm create-etherstub vsw0
sudo dladm create-vnic -l vsw0 int0

cat>/etc/hostname.int0 <<EOT
192.168.0.254 netmask 255.255.255.0 broadcast + up
EOT

apt install isc-dhcp-server

mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bckp

cat>/etc/dhcp/dhcpd.conf <<EOT
# A slightly different configuration for an internal subnet.
subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.100 192.168.0.200;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 8.8.8.8;
#  option domain-name "internal.example.org";
  option routers 192.168.0.254;
  option broadcast-address 192.168.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}
EOT

mv /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.bckp

cat>/etc/default/isc-dhcp-server <<EOT
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="int0"
INTERFACESv6=""
EOT

svcadm enable isc-dhcp-server

cat>cz.cfg <<EOT
create
set zonepath=/zones/cz
set autoboot=true
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
sudo zonecfg -z cz -f cz.cfg

cat>sz.cfg <<EOT
create
set zonepath=/zones/sz
set autoboot=true
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
sudo zonecfg -z sz -f sz.cfg

cat>rz.cfg <<EOT
create
set zonepath=/zones/rz
set autoboot=true
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
sudo zonecfg -z rz -f rz.cfg

sudo zoneadm -z cz install && sudo zoneadm -z cz boot
sudo zoneadm -z sz install && sudo zoneadm -z sz boot
sudo zoneadm -z rz install && sudo zoneadm -z rz boot

apt download socat

sudo apt -y -o Dir=/zones/cz/root update
sudo apt -y -o Dir=/zones/cz/root upgrade
sudo dpkg -i --root=/zones/cz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

sudo apt -y -o Dir=/zones/sz/root update
sudo apt -y -o Dir=/zones/sz/root upgrade
sudo dpkg -i --root=/zones/sz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

sudo apt -y -o Dir=/zones/sz/root update
sudo apt -y -o Dir=/zones/sz/root upgrade
sudo dpkg -i --root=/zones/sz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

reboot

After the script completes, restart the server and start cz, sz, rz zones and start net test.

  • No labels