KVM 第二个私有网络(桥接),如何工作?

use*_*961 4 networking debian iptables bridge kvm-virtualization

这似乎是一个难题。因此,我将非常感谢您的建议。我花了两天时间试图让它运行,但没有成功。(公共 IP 东西正在工作,但不是专用网络)

目标:

在 debian 挤压上使用 KVM 设置“第二个专用网络”


基础设施:

RootServer 1 = 有多个虚拟机
RootServer 2 = 有多个虚拟机
两个根服务器都有一个“公共”接口 = eth0(插入互联网)和一个“私有”接口 = eth1(直接插入交换机)
=>I只想在 10.1.0.0 网络中与其他盒子私下通信...


主机(/etc/network/interfaces)

auto  eth0
iface eth0 inet static
  address   11.11.11.91
  broadcast 11.11.11.95
  netmask   255.255.255.224
  gateway   11.11.11.65


# Private IP Adress of the HOST
auto eth1
iface eth1 inet static
  address 10.1.1.20
  broadcast 10.1.255.255
  netmask 255.255.0.0
  network 10.1.0.0


## Bridge vor Private Network
auto vbr2
iface vbr2 inet static
       address 10.1.1.21
       netmask 255.255.0.0
       pre-up brctl addbr vbr2
       post-up route add -host 10.1.1.100 vbr2
       post-down brctl delbr vbr2
Run Code Online (Sandbox Code Playgroud)

来宾:(/etc/network/interfaces)

auto eth0
iface eth0 inet static
  address 11.11.11.87
  netmask 255.255.255.255
  gateway 11.11.11.91
  pointopoint 11.11.11.91



## Private IP Address of the Guest
auto eth1
 iface eth1 inet static
 address 10.1.1.100
 netmask 255.255.255.255
 gateway 10.1.1.20
 pointopoint 10.1.1.20
Run Code Online (Sandbox Code Playgroud)

问题(从这里开始):

如果我ping 10.1.1.100在主机 (10.1.1.20/11.11.11.91) 上执行操作,即使驻留在同一台服务器上的 (10.1.1.100) 来宾也没有收到任何响应。所以任何内部路由的东西一定是错误的......但我无法解决这个问题?

更新:我只是想知道。也许我需要一个私有网络的“网关”。但另一方面,如果我使用网桥,为什么我需要为这个专用网络设置网关?

任何提示为什么这不起作用都非常感谢。

非常非常非常感谢!

dya*_*sny 6

你需要做的是一些事情。

  1. 不要为 NIC 本身提供 IP,网桥应该有那个 IP
  2. 确保您的路由表设置正确
  3. 如果来宾连接到两个网络,请确保他们获得两个分别插入公共和专用网桥的虚拟 NIC
  4. 确保虚拟机中的路由表正确。

组网方案如下:
eth0(no IP)->br0(with public IP)<-VM(public IP)
eth1(no IP)->br1(with private IP)<-VM(private IP)