I have a libvirt managed NAT network that has the following configuration:
<network connections="2">
<name>net-oss-private</name>
<uuid>eb196a1a-87ff-444d-a306-450f8d7d5a38</uuid>
<forward mode="nat">
<nat>
<port start="1024" end="65535"/>
</nat>
</forward>
<bridge name="virbr-oss" stp="on" delay="0"/>
<mac address="52:54:00:d5:ad:3e"/>
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.100" end="192.168.122.254"/>
<host mac="52:54:00:d0:aa:9e" name="oss-vm" ip="192.168.122.134"/>
<host mac="52:54:00:5e:50:3b" name="k8b0" ip="192.168.122.135"/>
</dhcp>
</ip>
</network>
The following host ip a
:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether d8:c4:97:f2:58:48 brd ff:ff:ff:ff:ff:ff
altname enp2s0f1
inet 192.168.0.2/24 brd 192.168.0.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 2002:c0a8:140:1:4386:6ddc:db75:1bf2/64 scope global temporary dynamic
valid_lft 298sec preferred_lft 298sec
inet6 2002:c0a8:140:1:fb2e:ecfc:1c6e:1b5b/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 298sec preferred_lft 298sec
inet6 fe80::f3b5:bd70:ae9:77f4/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bridge0 state UP group default qlen 1000
link/ether 00:00:00:00:2b:49 brd ff:ff:ff:ff:ff:ff
altname enp0s16u3
4: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether c6:2b:40:cc:41:6a brd ff:ff:ff:ff:ff:ff permaddr f8:a2:d6:ae:1c:79
altname wlp3s0
5: bridge0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:00:00:00:2b:49 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.135/24 brd 192.168.0.255 scope global dynamic noprefixroute bridge0
valid_lft 5238sec preferred_lft 5238sec
inet6 2002:c0a8:140:1:5c3b:6fb7:6de8:37a5/64 scope global temporary dynamic
valid_lft 298sec preferred_lft 298sec
inet6 2002:c0a8:140:1:d590:4d58:81fd:7d55/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 298sec preferred_lft 298sec
inet6 fe80::274a:b255:809b:604a/64 scope link noprefixroute
valid_lft forever preferred_lft forever
6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:d6:95:a9 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.1/24 brd 192.168.100.255 scope global virbr0
valid_lft forever preferred_lft forever
7: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master bridge0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:95:d2:97 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe95:d297/64 scope link
valid_lft forever preferred_lft forever
8: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master bridge0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:87:60:51 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe87:6051/64 scope link
valid_lft forever preferred_lft forever
9: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master bridge0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:91:1d:bf brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe91:1dbf/64 scope link
valid_lft forever preferred_lft forever
10: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master bridge0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:04:db:a7 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe04:dba7/64 scope link
valid_lft forever preferred_lft forever
11: cni-podman0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether f6:db:44:fe:8a:c6 brd ff:ff:ff:ff:ff:ff
inet 10.88.0.1/16 brd 10.88.255.255 scope global cni-podman0
valid_lft forever preferred_lft forever
inet6 fe80::f4db:44ff:fefe:8ac6/64 scope link
valid_lft forever preferred_lft forever
49: virbr-oss: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:d5:ad:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr-oss
valid_lft forever preferred_lft forever
58: vnet42: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master bridge0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:50:ae:b2 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe50:aeb2/64 scope link
valid_lft forever preferred_lft forever
59: vnet43: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master virbr-oss state UNKNOWN group default qlen 1000
link/ether fe:54:00:5e:50:3b brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe5e:503b/64 scope link
valid_lft forever preferred_lft forever
60: vnet44: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master virbr-oss state UNKNOWN group default qlen 1000
link/ether fe:54:00:d0:aa:9e brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fed0:aa9e/64 scope link
valid_lft forever preferred_lft forever
And sudo podman network create -d macvlan -o parent=virbr-oss -o mode=passthru podnet-oss
and the error is:
sudo podman run -d --rm --network podnet,podnet-oss --name nginx-oss nginx-oss
WARN[0000] Failed to load cached network config: network podnet not found in CNI cache, falling back to loading network podnet from disk
Error: plugin type="macvlan" failed (add): cni plugin macvlan failed: failed to create macvlan: invalid argument