I'm an Ubuntu newbie, I'm going to use Ubuntu to set up a KVM virtual machine, I only have a public IP, I know how to configure it in ifupdown, but I want to configure it in NetPlan.
My configuration in /etc/network/interface looks like this.
auto vmbr0
iface vmbr0 inet static
address 107.175.49.24/32
gateway 107.175.49.1
dns-nameservers 8.8.8.8
bridge-ports ens3
bridge-stp off
bridge-fd 0
dns-nameservers 8.8.8.8
auto vmbr1
iface vmbr1 inet static
address 192.168.0.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o br0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
iface vmbr1 inet6 static
address 2001:470:89c7:0000:0000:0000:0000:0001
netmask 48
bridge_ports tun0
bridge-stp off
bridge-fd 0
IPv4 is bound to ens3, IPv6 is bound to tun0, and NAT forwarding is enabled.
I am not able to specify parameters in netplan, when running netplan try it gives the br0: reverting custom parameters for bridges and bonds is not supported error, even if I force netplan apply it does not change anything.
Now my NetPlan configuration is as follows:
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
bridges:
br0:
addresses:
- "107.175.49.24/32"
nameservers:
addresses:
- "8.8.8.8"
interfaces:
- ens3
routes:
- to: "0.0.0.0/0"
via: "107.175.49.1"
metric: 1
br1:
addresses:
- "192.168.0.1/24"
- "2001:470:89c7::1/64"
I now need to solve two problems, how to declare bridge-stp in NetPlan, because he does not accept bridges under the parameters included parameters, and how to use NetPlan to add NAT forwarding
Other automation schemes are also accepted, but iptables-persistent is sometimes executed before br1 is up, so no rules can be added, and it will not uninstall the rules as br1 is shutdown.