Debian9 KVM bridge(桥接网络)
宿主机为debian9,kvm虚拟机桥接网络。适用于Hetzner。
首先安装:apt install -y bridge-utils
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
source /etc/network/interfaces.d/* auto lo iface lo inet loopback auto vmbr0 iface vmbr0 inet static address 95.xxx.xxx.xxx netmask 255.255.255.xxx gateway 95.xxx.xxx.xxx dns-nameservers 1.1.1.1 8.8.8.8 bridge_ports enp0s31f6 bridge_stp off bridge_fd 0 auto vmbr1 iface vmbr1 inet static address 10.10.10.1 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 '10.10.10.0/24' -o vmbr0 -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE |
Hetzner kvm虚拟机桥接网络,适用于debian系列