1, create a focal ovn test env
./generate-bundle.sh -s focal --name focal --num-compute 3 --ovn --vault --use-stable-charms --run
juju config neutron-api-plugin-ovn dns-servers=10.5.0.15
2, create 3 test VMs
./tools/instance_launch.sh 3 jammy
3, disable port security and firewall on instances ports
openstack port set --no-security-group --disable-port-security <port>
4, install IPVS on jammy-071431-1 according to the page [1], 192.168.21.177 is VIP.
apt install ipvsadm -y
ip link add eth-vip type dummy
ip link set eth-vip up
ip a add 192.168.21.177/24 dev eth-vip
echo 1 > /proc/sys/net/ipv4/ip_forward
ipvsadm -C
ipvsadm -A -t 192.168.21.177:80 -s rr
ipvsadm -a -t 192.168.21.177:80 -r 192.168.21.238 -g
ipvsadm -l -n
root@jammy-071431-1:~# ipvsadm -l -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.21.177:80 rr
-> 192.168.21.238:80 Route 1 0 0
5, install nginx on jammy-071431-2
apt install nginx -y
#tcpdump -nt -i any -p tcp port 80 -v
6, run 'curl <VIP>' on jammy-071431-3
curl 192.168.21.177
注:上面如果不想肜nginx的话,也可以改用ncat
#run on backend
ncat -k --listen --sctp -vv -p 80
#run on client
echo "hello world"| ncat --sctp 192.168.21.177 80