标签:配置 script stat start rip doc 网关 令行 http
1.查看网卡信息
ifconfig
2.在docker的centos7命令行中进行eth0设置
设置eth0网卡:vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 NAME="eth0" BRIDGE=br0 BOOTPROTO=dhcp NM_CONTROLLED=no ONBOOT=yes TYPE=Ethernet IPV4_FAILURE_FATAL=yes IPV6INIT=no USERCTL=no
3.新建网桥br0的配置(ip自定义的,不必纠结.网关是docker的网关)
设置br0网桥:vi /etc/sysconfig/network-scripts/ifcfg-br0 DEVICE="br0" TYPE="Bridge" NOBOOT="yes" BOOTPROTO="static" IPADDR="172.17.0.1" NETMASK="255.255.255.0" GATEWAY="172.17.42.1" DNS1="202.106.46.151" DNS2="202.106.195.68" DELAY="0"
4.在宿主机上重启容器,使网桥配置生效
docker restart centos-vnc
5.重新进入容器
docer exec -it centos-vnc /bin/bash
6.查看网络
ifconfig
7.网桥br0添加eth0端口
brctl show brctl addif br0 eth0 ifconfig eth0 0.0.0.0
8.Ping网络是否畅通
ping www.baidu.com
标签:配置 script stat start rip doc 网关 令行 http
原文地址:https://www.cnblogs.com/zhangkaipc/p/11493334.html