/etc/network/interfaces
and the config of the Windows vm qm config <vmid>
?# network interface settings; autogenerated
# Please do NOT modify this file directly, unless you know what
# you're doing.
#
# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto vlan1919
iface vlan1919 inet static
address xxx.xxx.xxx.xxx/28
gateway xxx.xxx.xxx.xxx
bridge_ports bond0.1919
dns-nameservers yyy.yyy.yyy.yyy zzz.zzz.zzz.zzz
auto eth1
iface eth1 inet manual
auto bond0
iface bond0 inet manual
bond-slaves eth0 eth1
bond-miimon 100
bond-mode 802.3ad
bond-lacp-rate fast
bond-xmit_hash_policy layer3+4
iface bond0.1919 inet manual
iface bond0.1920 inet manual
auto vlan1920
iface vlan1920 inet static
address 10.22.121.11/24
bridge_ports bond0.1920
auto vmbr0
iface vmbr0 inet static
address 192.168.10.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
auto vmbr1
iface vmbr1 inet static
address 192.168.10.101
netmask 255.255.255.0
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
boot: order=ide0;ide2;net0
cores: 4
ide0: local:101/vm-101-disk-0.qcow2,size=100G
ide2: local:iso/virtio-win.iso,media=cdrom,size=519172K
machine: pc-i440fx-5.2
memory: 4096
name: win1
net0: virtio=44:D9:7A:9B:E2:30,bridge=vmbr1
numa: 0
ostype: win10
scsihw: virtio-scsi-pci
smbios1: uuid=1418d177-a85b-3483-bf3b-9e057d9e9f0d
sockets: 1
vga: std
vmgenid: 96f3c372-db9d-4dcd-8e4b-2b52e0acc92e
root@lin1:~# ip address
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@if12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1a:dc:57:5e:7b:bc brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 192.168.10.15/24 brd 192.168.10.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::18dc:57ff:fe5e:7bbc/64 scope link
valid_lft forever preferred_lft forever
root@lin1:~# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=59 time=0.689 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=59 time=0.760 ms
^C
--- 1.1.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1016ms
rtt min/avg/max/mdev = 0.689/0.724/0.760/0.035 ms
root@lin1:~#
192.168.10.1
as your gateway. But I don't think the VM can see that IP because you added vmbr1 to your VM.auto vmbr0
iface vmbr0 inet static
address 192.168.10.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
auto vmbr1
iface vmbr1 inet static
address 192.168.10.101
netmask 255.255.255.0
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
/etc/network/interfaces
:auto vmbr0
iface vmbr0 inet static
address 192.168.10.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
auto vmbr0
iface vmbr0 inet static
address 192.168.10.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
auto vmbr1
iface vmbr1 inet static
address 192.168.10.101/24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.10.0/24' -o vlan1919 -j MASQUERADE
auto vmbr2
iface vmbr2 inet static
address 10.10.10.100/24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o vlan1919 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vlan1919 -j MASQUERADE
vmbr0
network I set the IP:192.168.10.16 MASK:255.255.255.0 GATEWAY:192.168.10.101vmbr1
's gateway. It is also working with GATEWAY:192.168.10.101 vmbr1
network i set the IP:192.168.10.16 MASK:255.255.255.0 GATEWAY:192.168.10.101vmbr2
network I set the IP:10.10.10.16 MASK:10.10.10.255 GATEWAY:10.10.10.16ip route
default via MY_MAIN_IP dev vlan1919 proto kernel onlink
10.10.10.0/24 dev vmbr2 proto kernel scope link src 10.10.10.100 linkdown
10.22.121.0/24 dev vlan1920 proto kernel scope link src 10.22.121.11
MY_MAIN_IP/28 dev vlan1919 proto kernel scope link src MY_MAIN_IP
192.168.10.0/24 dev vmbr0 proto kernel scope link src 192.168.10.1
192.168.10.0/24 dev vmbr1 proto kernel scope link src 192.168.10.101