When creating a VM make sure that the following are selected under networking
Attached to: Bridged NetworkManager
Adapter Type: PCnet-Fast III (Am 79C973)
Promiscious Mode Allow All
RHEL 6.5 / Fedora 20
Install docker, libvrt
Make sure the following are done using root
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
Create file ifcfg-xxxxx in /etc/sysconfig/network-scripts
DEVICE=xxxxx
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0
and append to ifcfg-p2p1
/ ifcfg-eth0
at the end of the file BRIDGE=xxxx
Restart the VM
run
brctl show
to make sure the bridged connected has an adapter either p2p1
or eth0
e.g.
# brctl show
bridge name bridge id STP enabled interfaces
gsbr01 8000.080027595649 no eth0
virbr0 8000.5254004c1564 yes virbr0-nic
now before starting docker we have to use our bridge and not docker0
to do that, run docker as docker -d -b=gsbr01
$ echo 'DOCKER_OPTS="-b=gsbr01"' >> /etc/sysconfig/docker
$ sudo service docker start
Check the result:
# brctl show
bridge name bridge id STP enabled interfaces
gsbr01 8000.080027595649 no eth0
veth5806f27
vethb3e33da
virbr0 8000.5254004c1564 yes virbr0-nic
docker -d -b=gsbr01
--net=host
. Or do you want to bind the port to not be random? – Virescence