Home  >  Article  >  Operation and Maintenance  >  How to customize the network bridge in centos environment

How to customize the network bridge in centos environment

藏色散人
藏色散人forward
2021-03-05 15:48:062323browse

The following tutorial column from centos will introduce to you how to customize the network bridge in the centos environment. I hope it will be helpful to friends in need!

1. Stop the docker service and delete the old bridge

service docker stop
ip link set dev dev bridge0 down
brctl delbr docker0

2. Create a new bridge docker0 and configure its IP address

brctl addbr bridge0                      //添加新网桥,bridge0为新网桥的名称
ip addr add 192.168.1.100/24 dev bridge0          //为网桥配置IP地址,此处可以将IPv4地址替换为IPv6地址,也可分两次为该网桥分别添加IPv4和IPv6地址
ip link set dev bridge0 up           //启动网桥

3. Modify the docker configuration file and bridge to the created bridge by default

Add configuration options in the docker-network file

echo 'DOCKER_OPTS="-b=bridge0" ' >> /ect/sysconfig/docker-network

4. Start the docker service

service docker start

5. Create a new container and check whether the IP address of the container is in the same C as the bridge address. part

The above is the detailed content of How to customize the network bridge in centos environment. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete