VMware NAT方式 CentOS 6.8配置静态IP

一、打开虚拟机设置,配置网络连接,如下图

QQ图片20161220092227

二、编辑 /etc/sysconfig/network,以配置网关

vim  /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mylinux03
#添加网关
GATEWAY=192.168.26.2

三、编辑 /etc/sysconfig/network-scripts/ifcfg-eth0,以配置IP

vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=7fa84877-75e9-4d0d-9e54-cdcd288dbc49
ONBOOT=yes
NM_CONTROLLED=no # yes改为no
BOOTPROTO=static # dhcp改为static
HWADDR=00:0C:29:BF:EB:97
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"

#添加IP、子网掩码、网关、DNS1 配置
IPADDR=192.168.26.12
NETMASK=255.255.255.0
GATEWAY=192.168.26.2

DNS1=192.168.26.2

四、重启服务

service network restart

参考:http://blog.csdn.net/jack85986370/article/details/51009053

posted @ 2016-12-20 09:46  i迷倪  阅读(2151)  评论(0编辑  收藏  举报