第6章 ネットワーク設定
- Network Address Translation (NAT) を使用した仮想ネットワーク
- PCI デバイス割り当てを使用して直接割り当てられた物理デバイス
- PCIe SR-IOV を使用して直接割り当てられた仮想機能
- ブリッジネットワーク
6.1. libvirt を使用した Network Address Translation (NAT)
標準的な libvirt インストールはすべて、デフォルトの仮想ネットワークとして 仮想マシンへのNAT ベースの接続を提供します。これが virsh net-list --all コマンドで利用可能であることを確認します。
# virsh net-list --all
Name State Autostart
-----------------------------------------
default active yes
# ll /etc/libvirt/qemu/
total 12
drwx------. 3 root root 4096 Nov 7 23:02 networks
-rw-------. 1 root root 2205 Nov 20 01:20 r6.4.xml
-rw-------. 1 root root 2208 Nov 8 03:19 r6.xml/etc/libvirt/qemu/networks/default.xml で定義されています。
# virsh net-autostart default
Network default marked as autostarted# virsh net-start default
Network default startedlibvirt デフォルトのネットワークが実行されると、分離されたブリッジデバイスが表示されます。このデバイスには、物理インターフェースが追加されて いません。新規デバイスは、NAT および IP 転送を使用して物理ネットワークに接続します。新規インターフェースを追加しないでください。
# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.000000000000 yeslibvirt は iptables ルールを追加します。このルールは、INPUT、FORWARD、OUTPUT、POSTROUTING チェーンで virbr0 デバイスに割り当てられたゲスト仮想マシンから/へのトラフィックを可能にするものです。次に libvirt は、ip_forward パラメーターの有効化を試みます。別のアプリケーションが ip_forward を無効にする場合もあるので、/etc/sysctl.conf に以下を追加することが最善の選択肢です。
net.ipv4.ip_forward = 1
ホスト設定が完了したら、ゲスト仮想マシンはその名前をベースにした仮想ネットワークに接続できます。ゲストを「デフォルト」の仮想ネットワークに接続するには、ゲストの XML 設定ファイル (/etc/libvirtd/qemu/myguest.xml など) で以下を使用します。
<interface type='network'> <source network='default'/> </interface>
注記
<interface type='network'> <source network='default'/> <mac address='00:16:3e:1a:b3:4a'/> </interface>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.