/etc/sysconfig/network-scripts
[root@localhost]# ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:dff:fe04:70eb prefixlen 64 scopeid 0x20<link> ether 02:42:0d:04:70:eb txqueuelen 0 (Ethernet) RX packets 667 bytes 1606039 (1.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 997 bytes 272465 (266.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.229.175 netmask 255.255.0.0 broadcast 192.168.255.255 inet6 fe80::e6f1:a244:8e00:5639 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:1f:1d:a2 txqueuelen 1000 (Ethernet) RX packets 1806 bytes 356013 (347.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2057 bytes 2644609 (2.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 veth3af3ed4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::a4d2:2ff:fe1a:e6cd prefixlen 64 scopeid 0x20<link> ether a6:d2:02:1a:e6:cd txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 23 bytes 1873 (1.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 veth5705b61: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::30c3:96ff:fe3c:5a0f prefixlen 64 scopeid 0x20<link> ether 32:c3:96:3c:5a:0f txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 25 bytes 2133 (2.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 vethb48dd9e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::8493:b0ff:fe99:3410 prefixlen 64 scopeid 0x20<link> ether 86:93:b0:99:34:10 txqueuelen 0 (Ethernet) RX packets 667 bytes 1615377 (1.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 997 bytes 272252 (265.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:04:9d:27 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost]# vim ifcfg-ens33 TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" # 使用靜態IP地址,默認爲dhcp IPADDR="192.168.241.100" # 設置的靜態IP地址 NETMASK="255.255.255.0" # 子網掩碼 GATEWAY="192.168.241.2" # 網關地址 DNS1="192.168.241.2" # DNS服務器 DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" UUID="95b614cd-79b0-4755-b08d-99f1cca7271b" DEVICE="ens33" ONBOOT="yes" #是否開機啓用
[root@localhost]# service network restart [root@localhost]# systemctl restart newwork.service
其餘輔助docker
[root@localhost]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 184.82.152.96 0.0.0.0 255.255.255.248 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 184.82.152.97 0.0.0.0 UG 0 0 0 eth0
[root@localhost]# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 184.82.152.96 0.0.0.0 255.255.255.248 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 184.82.152.97 0.0.0.0 UG 0 0 0 eth0
[root@localhost]# cat /etc/resolv.conf
[root@localhost]# hostnamectl set-hostname mini1