Debian 11(サーバ)でのネットワーク設定例(ブリッジあり)

設定例

以下は/etc/network/interfacesの内容。ここでは、ブリッジbr0に物理NICenp6s0を含む。
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp6s0
iface enp6s0 inet manual

auto br0
iface br0 inet static
  bridge_ports enp6s0
  address 192.168.10.10
  netmask 255.255.255.0
  gateway 192.168.10.1
  dns-nameservers 192.168.10.1
  bridge_stp off
  bridge_maxwait 0

注記

上記の設定には'bridge-utils'パッケージが必要です。

ブリッジを使う利点

物理NICをブリッジに含めておくと、下図のようにLXCコンテナやQEMUのインスタンスをホストマシンが所属するネットワークに容易に接続できる。macvlanやmacvtapだと、ホストOSと仮想マシンが通信できない課題があるが、この方法ならそれを解決できる。

0 件のコメント: