KVM - natまたはブリッジ。どうしたの?

KVM - natまたはブリッジ。どうしたの?

Debian Jessie サーバーと Apache サーバーがインストールされています。 Apacheは異なるIPアドレスで複数のサイトをホストします。私のサーバーにKVMリソースがあります。私の質問は -無料IPをゲストKVMシステムに設定するにはどうすればよいですか?。私の無料IPはe​​th0:3 - > 80.80.130.135です。私の設定/etc/network/interfacesファイルは次のとおりです。

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

auto eth0
auto eth0:0
auto eth0:1
auto eth0:2
auto eth0:3

allow-hotplug eth0
iface eth0 inet static
    address 80.80.130.131
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    gateway 80.80.130.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain

iface eth0:0 inet static
    address 80.80.130.132
    netmask 255.255.255.192
    network 80.80.130.128
    gateway 80.80.130.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain


iface eth0:1 inet static
    address 80.80.130.133
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain


iface eth0:2 inet static
    address 80.80.130.134
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain


iface eth0:3 inet static
    address 80.80.130.135
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    dns-search localdomain

ベストアンサー1

  1. /etc/network/interfacesブリッジインターフェイスを使用するようにjessieホストを変更しますeth0

たとえば、eth0エイリアスeth0:*定義を削除し、次を追加します。

auto br0
iface br0 inet static
    address 80.80.130.131
    netmask 255.255.255.192
    network 80.80.130.128
    broadcast 80.80.130.191
    gateway 80.80.130.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 85.17.151.123 62.211.64.122
    post-up ip addr add 80.80.130.132 dev br0
    post-up ip addr add 80.80.130.133 dev br0
    post-up ip addr add 80.80.130.134 dev br0
    bridge_ports eth0
    bridge_stp off
    bridge_maxwait 1
    bridge_fd 1
    bridge_hello 2
    bridge_maxage 12

再起動後にifdown -a ; ifup -aゲストを設定することもできます。

  1. virt-manager を使用してbr0GUI を使用してこれを行うか、XML ファイルを編集し、virsh edit domainnameインターフェース定義を次のように変更することでこれを行うことができます。
<interface type='bridge'>
  <mac address='xx:xx:xx:xx:xx:xx'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
  1. /etc/network/interfacesこれで、静的IP 80.80.130.135(または他のDebianシステムではない場合はVMに適したすべてのIPアドレス)を使用するようにゲストを設定するか、dnsmasqそのIPをVMに割り当てるMACアドレスを設定できます。

おすすめ記事