bridge
/etc/network/interface
auto br0
iface br0 inet static
address 192.168.100.61
netmask 255.255.255.0
gateway 192.168.100.1
dns-nameservers 8.8.8.8 8.8.4.4
#
bridge_ports enp2s0
bridge_maxwait 0
bridge_df 0
bridge_stp off
$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no enp2s0
docker0 8000.000000000000 no
lxcbr0 8000.000000000000 no
virbr0 8000.000000000000 yes virbr0-nic
IP2つ目割り当て
eth0と同じmacアドレスでeth0:0を作成
作成
$ ifconfig eth0:0 192.168.11.99/24
削除
ifconfig eth0:0 down
/etc/network/interfaces
/etc/network/interfaces
iface eth0:0 inet static
address 192.168.11.99
netmask 255.255.255.0
仮想NIC
eth0と違うmacアドレスでmacvlan0を作成
作成
$ sudo ip link add dev macvlan0 link eth0 type macvlan
$ sudo ifconfig macvlan0 up
$ sudo dhclient macvlan0
- Centos5.8だとUbuntuとip コマンドオプションが異なる様子。
削除
$ sudo ifconfig macvlan0 down
$ sudo ip link del dev macvlan0
/etc/network/interfaces
/etc/network/interfaces
iface macvlan0 inet static
address 192.168.11.98
netmask 255.255.255.0
pre-up ip link add macvlan0 link eth0 type macvlan
lxc
/var/lib/lxc//config
lxc.network.type=macvlan
lxc.network.macvlan.mode=bridge
lxc.network.link=eth0
lxc.network.flags=up
lxc.network.name=eth0