VMWare虚拟机配置固定IP

一、在菜单栏选择编辑→ 虚拟网络编辑器,打开虚拟网络编辑器对话框,选择Net网络连接方式,随意设置子网IP,点击NAT设置页面,查看子网掩码和网关,后面修改静态IP会用到。

二、进入虚拟机
vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:F4:7E:C9"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="2a76c2f8-cd47-44af-936d-11559b3a498d"
IPADDR="192.168.0.100"
NETMASK="255.255.255.0"
GATEWAY="192.168.0.1"

三、配置 DNS
vim /etc/resolv.conf
文件末尾添加

nameserver 114.114.114.114

四、查看防火墙状态并关闭

1.查看防火状态
# centos6的方法
systemctl status firewalld
# centos7的方法
service  iptables status

2:暂时关闭防火墙
systemctl stop firewalld
service  iptables stop

3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off

4:重启防火墙
systemctl enable firewalld
service iptables restart  

5:永久关闭后重启
chkconfig iptables on 


五、重启网卡

systemctl restart network
service network restart

六、设置主机和IP绑定信息
vim /etc/hosts

七、设置主机名
vim /etc/hostname

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码出天空

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值