本文共 3059 字,大约阅读时间需要 10 分钟。
[root@localhost ~]# cat /etc/resolv.conf # Generated by NetworkManagersearch lannameserver fd7b:ac2f:6d73::1
8.8.8.8 #google域名服务器 8.8.4.4 #google域名服务器 192.168.10.1 #网卡对应的网关的IP地址(默认网关)255.255.255.0 #网卡对应的网络掩码(子网掩码)192.168.10.56 #网卡对应的ip地址
[root@localhost sysconfig]# pwd/etc/sysconfig[root@localhost sysconfig]# vim network[root@localhost sysconfig]# cat network
# Created by anacondaNETWORKING=yes HOSTNAME=CentOS-Slave1NETWORKING_IPV6=no PEERNTP=noGATEWAY=192.168.10.1
[root@CentOS-Slave1 network-scripts]# pwd/etc/sysconfig/network-scripts[root@CentOS-Slave1 network-scripts]# vim ifcfg-enp0s3 [root@CentOS-Slave1 network-scripts]# cat ifcfg-enp0s3
DEVICE=enp0s3ONBOOT=yesBOOTPROTO=staticIPADDR=192.168.10.56NETMASK=255.255.255.0DNS1=8.8.8.8 DNS2=8.8.4.4
[root@localhost etc]# pwd/etc[root@localhost etc]# vim hosts[root@localhost etc]# cat hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.10.56 CentOS-Slave1
[root@localhost init.d]# service network restartRestarting network (via systemctl): [ OK ]
[root@localhost init.d]# cat /etc/resolv.conf # Generated by NetworkManagersearch lan lan.nameserver 8.8.8.8nameserver 8.8.4.4nameserver fd7b:ac2f:6d73::1注:DNS已经配置完毕!
[root@localhost init.d]# hostnameCentOS-Slave1
[root@CentOS-Slave1 /]# ifconfigenp0s3: flags=4163mtu 1500 inet 192.168.10.56 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::a00:27ff:fe87:b3c0 prefixlen 64 scopeid 0x20 ether 08:00:27:87:b3:c0 txqueuelen 1000 (Ethernet) RX packets 44075 bytes 47664947 (45.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9704 bytes 1365665 (1.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 0 (Local Loopback) RX packets 3 bytes 303 (303.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3 bytes 303 (303.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
DEVICE=enp0s3TYPE=EthernetBOOTPROTO=staticONBOOT=yesDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_FAILURE_FATAL=noNAME=enp0s3UUID=f4ff103e-5adc-4456-b338-d66b1b63bb46IPADDR=192.168.10.56NETMASK=255.255.255.0DNS1=8.8.8.8 DNS2=8.8.4.4
转载地址:http://lnkda.baihongyu.com/