In order to use the Network Bridge in the form of Docker to access the intranet directly, you need to configure Docker, the actual test is as follows (need to pay attention to the Docker version of the problem)
# eth1:192.168.56.101
# eth2:192.168.58.101
# 192.168.56.0/24 Management Network
# 192.168.58.0/24 Data network, the network used by the container
# switch to the root user to execute the following command
1. Configure Linux Bridge
Brctl ADDBR Br0
IP addr Add 192.168.58.110/24 dev br0
# set an IP to the bridge so that the host can access the container directly
IP link set Dev br0 up
2. Configure the Docker daemon
Echo ' docker_opts= '-b=br0 ' >>/etc/default/docker
sudo service docker start
3. Start the container, set the network mode to none, configure the container network yourself
sudo docker run-it--net=none Ubuntu:14.04/bin/bash
4. View Container Process ID
Docker Inspect-f ' {. State.pid}} ' container_id
Pid=xxx
5. Create a namespaces directory
Mkdir-p/var/run/netns
Ln-s/proc/$pid/ns/net/var/run/netns/$pid
6. Create Veth device, assign to container, bind to bridge
IP link Add vetha type Veth peer name VETHB
Brctl addif br100 VETHB
IP link Set VETHB up
IP link set vetha netns $pid
IP netns exec $pid IP link set dev Vetha name eth0
IP netns exec $pid IP link set eth0 up
IP netns exec $pid IP addr add 192.168.58.121/24 dev eth0
IP netns exec $pid IP route add default via 192.168.58.110
7, bound eth2 to the bridge
Brctl addif br0 eth2
IP addr del 192.168.58.101/24 dev eth2 # remove eth2 IP
IP addr Add 192.168.58.101/24 dev br0 # Add eth2 IP to the bridge
Use the bridge form under Docker