Linux静态ip
- Ⅰ、修改静态ip
Ⅰ、修改静态ip
修改静态ip必须是root用户
su root //切换root用户
ip a //查看修改前的动态ipvi /etc/sysconfig/network-scripts/ifcfg-ens33 //打开网卡配置文件,修改一处,新增四处
BOOTPROTO="static" //修改配置:将dhcp修改为static
IPADDR="192.168.130.130" //新增:配置静态IP地址
NETMASK="255.255.255.0" //新增:配置子网掩码
GATEWAY="192.168.130.0" //新增:配置网关
DNS1="114.114.114.114" //新增:配置DNSservice network restart //重启网卡ip a //查看修改后的静态ip
修改完成后测试主机虚拟机互ping,ping不通说明虚拟机防火墙没关
systemctl disable firewalld //禁止防火墙开机自启
systemctl stop firewalld //关闭防火墙
systemctl status firewalld //查看防火墙状态