真实网卡配置文件
/etc/sysconfig/network-scripts/ifcfg-eth0
虚拟网卡配置文件
/etc/sysconfig/network-scipts/ifcfg-eth0:0
TYPE=Ethernet BOOTPROTO=static NAME=eth0:0 DEVICE=eth0:0 ONBOOT=yes IPADDR=
网桥
[root@docker01 ~]# yum -y install bridge-utils [root@docker01 ~]# cd /etc/sysconfig/network-scripts/ [root@docker01 network-scripts]# cp ifcfg-eth0 ifcfg-docker0 [root@docker01 network-scripts]# vim ifcfg-docker0 DEVICE="docker0" ONBOOT="yes" IPV6INIT="no" IPV4_FAILURE_FATAL="no" NM_CONTROLLED="no" TYPE="Bridge" BOOTPROTO="static" IPADDR="192.168.1.21" [root@docker01 network-scripts]# docker network list NETWORK ID NAME DRIVER SCOPE 8e868f9c8f66 bridge bridge local b19e0b0eb904 host host local c8732042ae83 none null local [root@docker01 network-scripts]# brctl show bridge name bridge id STP enabled interfaces docker0 8000.024241d392f5 no
使用docker创建网桥 (docker network create --driver bridge docker1)
[root@docker01 ~]# docker network create --subnet=10.10.10.0/24 docker1 [root@docker01 ~]# docker run -it --network=docker1 myos # 使用虚拟交换机