0

Xenハイパーバイザーには、Virtual Managerで見たように、ネットワーク構成用に2つのモードがあります。1NAT2ルーティング。どちらもIPサブネットを要求します。ただし、XenのDHCPによって割り当てられるのではなく、任意のIPを割り当てることができるネットワークを構成したいと思います。

私はoracleVirtualBoxを使用しましたが、ホストオンリーアダプタを使用するオプションがあります。Xenをそのように使いたいです。

つまり、物理ネットワークインターフェイスをゲストマシン(VM)と共有したい

CentOS6.2x86_64でXenHypervisor3.xを使用しています

私はこれが私のために働いた問題を解決するために次のことをしました。

Disabling Xen's network scripts
If using Xen it is recommended to disable its network munging by editing /etc/xen/xend-config.sxp and changing the line
(network-script network-bridge)

To be

(network-script /bin/true)

Disabling NetworkManager

As of the time of writing (Fedora 12), NetworkManager still does not support bridging, so it is necessary to use "classic" network initscripts for the bridge, and to explicitly mark them as independent from NetworkManager (the "NM_CONTROLLED=no" lines in the scripts below).

If desired, you can also completely disable the NetworkManager:

# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start

Creating network initscripts

In the /etc/sysconfig/network-scripts directory it is neccessary to create 2 config files. The first (ifcfg-eth0) defines your physical network interface, and says that it will be part of a bridge:

# cat > ifcfg-eth0 <<EOF
DEVICE=eth0
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
EOF

Obviously change the HWADDR to match your actual NIC's address. You may also wish to configure the device's MTU here using e.g. MTU=9000.

The second config file (ifcfg-br0) defines the bridge device:

# cat > ifcfg-br0 <<EOF
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0
NM_CONTROLLED=no
EOF

WARNING: The line TYPE=Bridge is case-sensitive - it must have uppercase 'B' and lower case 'ridge'

After changing this restart networking (or simply reboot)

# service network restart

詳細については、をご覧ください

4

1 に答える 1

1

Xen の場合、これはブリッジ ネットワークの特殊なケースにすぎません。

CentOS Dom0 にダミー ブリッジを作成し、VM をそのブリッジに接続します。

CentOS ドキュメント (http://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Virtualized_network_devices-Laptop_network_configuration.html) から

dummy0 ネットワーク インターフェイスを作成し、静的 IP アドレスを割り当てます。

この例では、環境内のルーティングの問題を回避するために 10.1.1.1 を選択しました。ダミー デバイスのサポートを有効にするには、次の行を /etc/modprobe.conf に追加します。

alias dummy0 dummy
options dummy numdummies=1

dummy0 のネットワークを設定するには、/etc/sysconfig/network-scripts/ifcfg-dummy0 を編集/作成します。

DEVICE=dummy0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.0
IPADDR=10.1.1.1
ARP=yes

次に、VMをdummy0ブリッジデバイスに接続するだけです

追加参照 http://wiki.xen.org/wiki/HostConfiguration/Networking

于 2012-04-21T22:08:32.023 に答える