下面进行CENTOS 7 静态网络的配置(能连接外网):
网络模式为NAT模式
下面把IP改为静态IP
在root用户进行如下操作:
[root@localhost hadoop]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@localhost network-scripts]# ls
ifcfg-eno16777736 ifdown-ippp ifdown-sit ifup-bnep ifup-plip ifup-Team network-functions-ipv6
ifcfg-lo ifdown-ipv6 ifdown-Team ifup-eth ifup-plusb ifup-TeamPort
ifdown ifdown-isdn ifdown-TeamPort ifup-ib ifup-post ifup-tunnel
ifdown-bnep ifdown-post ifdown-tunnel ifup-ippp ifup-ppp ifup-wireless
ifdown-eth ifdown-ppp ifup ifup-ipv6 ifup-routes init.ipv6-global
ifdown-ib ifdown-routes ifup-aliases ifup-isdn ifup-sit network-functions
[root@localhost network-scripts]# vi ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
#IPV6INIT=yes
#IPV6_AUTOCONF=yes
#IPV6_DEFROUTE=yes
#IPV6_PEERDNS=yes
#IPV6_PEERROUTES=yes
#IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=fec5ab95-21f6-4f0c-b606-0eb32bc0605a
DEVICE=eno16777736
ONBOOT=yes
DNS1=114.114.114.114
IPADDR=192.168.178.100
NETMASK=255.255.255.0
GATEWAY=192.168.178.2
[root@localhost network-scripts]# service network restart
查看修改后的IP(并且能够连接外网)
至此CENTOS 7 静态网络的配置(能连接外网)安装完毕