...
/var/tmp/test_results/<ISO TIME>
Script for preparing the working environment of a network test
Code Block | ||
---|---|---|
| ||
#!/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="vnic8"
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.