ubuntu 10.04;kvm 桥接网络无法与公共 IP 地址配合使用

ubuntu 10.04;kvm 桥接网络无法与公共 IP 地址配合使用

我有一个专用的托管服务器盒,其中安装了 ubuntu 10.04 64 位。我想在安装了 ubuntu 8.04 的情况下运行 kvm,以便运行一些兼容 php 5.2 的应用程序(它们无法与 php 5.3(ubuntu 10.04 中的默认版本)一起正常运行)。

我按照以下说明安装了 KVMhttps://help.ubuntu.com/community/KVM/Installation。我使用 virt-manager 安装了虚拟机。我一直搞不清楚如何使用 virt-install 或任何自动安装程序。我只是使用光盘安装了它。我按照以下说明设置了桥接网络https://help.ubuntu.com/community/KVM/Networking。但是,桥接连接不起作用。

这是我的主机上的 /etc/network/interfaces,运行 ubuntu 10.04。(特定公共 IP 为空白)

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
        address xx.xx.xx.xx
        netmask 255.255.255.248
        gateway xx.xx.xx.xa
        bridge_ports eth0
        bridge_stp on
        bridge_fd 0
        bridge_maxwait 10
`

这是我的客户机上的 /etc/network/interfaces,运行 ubuntu 8.04。

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address xx.xx.xx.xy
netmask 255.255.255.248
gateway xx.xx.xx.xa

两个虚拟机可以互相通信。但是,客户虚拟机无法访问现实世界中的任何人。

这是我的 /etc/libvirt/qemu/store_804.xml

<domain type='kvm'>
  <name>store_804</name>
  <uuid>27acfb75-4f90-a34c-9a0b-70a6927ae84c</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
            <type arch='x86_64' machine='pc-0.12'>hvm</type>
            <boot dev='hd'/>
              </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
      <on_crash>restart</on_crash>
      <devices>
            <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/store_804.img'/>
      <target dev='hda' bus='ide'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
            </disk>
                    <interface type='bridge'>
      <mac address='52:54:00:26:0b:c6'/>
      <source bridge='br0'/>
      <model type='virtio'/>
        </interface>
    <console type='pty'>
      <target port='0'/>
    </console>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
            <sound model='es1370'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
    </video>
  </devices>
</domain>

知道我哪里做错了吗?

答案1

在这样的环境中,您无法使用桥接模式,几乎可以肯定托管合作伙伴将阻止所有不来自您服务器中真实 NIC 的 MAC 地址的流量。您需要设置路由设置,其中所有往返于 VM 客户机的流量都通过您的主机发送。一种方法是使用 Libvirt 对路由网络的本机支持(网络 XML 配置中的“forward mode=”route”)。

有一家德国服务器托管公司就此主题编写了几份指南,如果您不懂德语,您可以使用谷歌翻译将其翻译成英文:) http://wiki.hetzner.de/index.php/Kategorie:KVM

答案2

客人还需要默认路线。你有吗?

那么,您这样做只是为了获得应用程序的新版本(降级版本)?为什么不直接在主机中构建(或查找,或从源代码安装)PHP 6.2 包?

相关内容