$ sudo ip link add name atx-fabric0 type bridge
$ sudo ip link set up dev atx-fabric0
$ sudo ip tuntap add atx-fabric0i1p1 user $USER group $USER
$ sudo ip tuntap add atx-fabric0i2p1 user $USER group $USER
# create two focal VM images from focal daily server
$ qemu-img create -f qcow2 -b focal-server-cloudimg-amd64.img focal-net1.img 100G
$ qemu-img create -f qcow2 -b focal-server-cloudimg-amd64.img focal-net2.img 100G
# Create a bridge and add two ports
$ sudo ip link add name atx-fabric0 type bridge
$ sudo ip link set up dev atx-fabric0
$ sudo ip tuntap add atx-fabric0i1p1 user $USER group $USER
$ sudo ip tuntap add atx-fabric0i2p1 user $USER group $USER
# create two focal VM images from focal daily server cloudimg- amd64.img focal-net1.img 100G cloudimg- amd64.img focal-net2.img 100G
$ qemu-img create -f qcow2 -b focal-server-
$ qemu-img create -f qcow2 -b focal-server-
# create cloud-init seed
$ cat >user-data <<EOF
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
ssh_import_id: lp:raharper
EOF
$ echo "i-abcdefg" > meta-data
$ cloud-localds seed.img user-data meta-data
# Launch VM1 (need sudo for bridge access)
BOOT=focal-net1.img if=none, format= qcow2,file= ${BOOT} \ blk-pci, drive=disk0, bootindex= 0 \ if=none, media=cdrom, file=$SEED \ blk-pci, drive=cdrom0, bootindex= 1 \ net0,hostfwd= tcp::22222- :22 \ =2,netdev= net0,mac= 52:54:00: a2:34:c0 \ net1,ifname= atx-fabric0i1p1 \ net,bootindex= 4,netdev= net1,mac= b8:38:61: bc:60:f5 \ filename= /dev/urandom, id=rng0 \ rng-pci, rng=rng0 \
SEED=seed.img
sudo qemu-system-x86_64 -smp 2 -m 2048 --enable-kvm \
-global pc35.no_floppy=1 \
-name "${1}" \
-drive id=disk0,
-device virtio-
-drive id=cdrom0,
-device virtio-
-netdev user,id=
-device e1000,bootindex
-netdev tap,id=
-device virtio-
-nographic \
-object rng-random,
-device virtio-
-serial mon:stdio
# Login and replace netplan config init-vm1. yaml << EOF init-vm1. yaml ubuntu@localhost: 50-cloud- init-vm1. yaml /etc/netplan/ 50-cloud- init.yaml'
cat > 50-cloud-
network:
version: 2
ethernets:
ens5:
match:
macaddress: "52:54:00:a2:34:c0"
accept-ra: false
dhcp4: true
dhcp6: false
mtu: 1500
eth2-1:
optional: true
match:
macaddress: b8:38:61:bc:60:f5
set-name: eth2-1
accept-ra: false
dhcp4: false
dhcp6: false
mtu: 1500
addresses:
- 6.1.6.1/24
- 2006:1:6::1/116
routes:
- from: 6.1.6.1
scope: link
to: 6.1.6.254
- from: 2006:1:6::1
scope: link
to: 2006:1:6::254
- to: default
via: 2006:1:6::254
metric: 32
- to: default
via: 6.1.6.254
metric: 32
eth2-2:
match:
macaddress: b8:38:61:bc:60:f6
set-name: eth2-2
accept-ra: false
dhcp4: false
dhcp6: false
mtu: 1500
EOF
scp -P 22222 50-cloud-
ssh -P 22222 'sudo cp /home/ubuntu/
ssh -P 22222 'sudo netplan apply'
# Launch VM2 (need sudo for bridge access)
BOOT=focal-net2.img if=none, format= qcow2,file= ${BOOT} \ blk-pci, drive=disk0, bootindex= 0 \ if=none, media=cdrom, file=$SEED \ blk-pci, drive=cdrom0, bootindex= 1 \ net0,hostfwd= tcp::22223- :22 \ =2,netdev= net0,mac= 52:54:00: ef:88:a2 \ net1,ifname= atx-fabric0i2p1 \ net,bootindex= 4,netdev= net1,mac= b8:38:61: bc:60:f6 \ filename= /dev/urandom, id=rng0 \ rng-pci, rng=rng0 \
SEED=seed.img
sudo qemu-system-x86_64 -smp 2 -m 1024 --enable-kvm \
-global pc35.no_floppy=1 \
-name "${1}" \
-drive id=disk0,
-device virtio-
-drive id=cdrom0,
-device virtio-
-netdev user,id=
-device e1000,bootindex
-netdev tap,id=
-device virtio-
-nographic \
-object rng-random,
-device virtio-
-serial mon:stdio
# Login and replace netplan config init-vm2. yaml << EOF
cat > 50-cloud-
network:
version: 2
ethernets:
ens5:
match:
macaddress: "52:54:00:ef:88:a2"
accept-ra: false
dhcp4: true
dhcp6: false
mtu: 1500
eth2-1:
match:
macaddress: b8:38:61:bc:60:f5
set-name: eth2-1
accept-ra: false
dhcp4: false
dhcp6: false
mtu: 1500
eth2-2:
optional: true
match:
macaddress: b8:38:61:bc:60:f6
set-name: eth2-2
accept-ra: false
dhcp4: false
dhcp6: false
mtu: 1500
addresses:
- 6.1.6.1/24
- 2006:1:6::1/116
routes:
- from: 6.1.6.1
scope: link
to: 6.1.6.254
- from: 2006:1:6::1
scope: link
to: 2006:1:6::254
- to: default
via: 2006:1:6::254
metric: 32
- to: default
via: 6.1.6.254
metric: 32
EOF
scp -P 22222 50-cloud- init-vm1. yaml ubuntu@localhost: 50-cloud- init-vm1. yaml /etc/netplan/ 50-cloud- init.yaml'
ssh -P 22222 'sudo cp /home/ubuntu/
ssh -P 22222 'sudo netplan apply'