#!/bin/sh export PATH=/usr/local/bin:"$PATH" jname="tj" ename="epair_$jname" set -e echo "====> Install packages" pkg install -y haproxy hey echo "====> Remove some leftovers" ( killall hey || true jail -r "$jname" || true ifconfig $ename destroy || true ) 2>/dev/null sleep 1 echo "====> Create interfaces" intf=$(ifconfig epair create) jintf=$(echo "$intf" | sed "s|a$|b|") ifconfig "$intf" name $ename ifconfig $ename 10.233.185.1/24 echo "====> Create and start jail" jail -c vnet name="$jname" persist path=/ \ host.hostname="$jname" vnet.interface="$jintf" jexec "$jname" ifconfig lo0 127.0.0.1/8 jexec "$jname" ifconfig "$jintf" 10.233.185.2/24 up jexec "$jname" route add default 10.233.185.1 cat >/tmp/haproxy.conf< Start hey instances" hey -h2 -n 10 -c 10 -z 300s http://10.233.185.2& hey -h2 -n 10 -c 10 -z 300s http://10.233.185.2& hey -h2 -n 10 -c 10 -z 300s http://10.233.185.2& echo "====> Ping jail" ping 10.233.185.2