步骤1:使用vi编辑 /etc/sysconfig/network-scripts/目录下的ifcfg-ens160 配置文件
[[email protected] ~]# [[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens160 TYPE="Ethernet" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" NAME="ens160" UUID="c6456ss4-4c61-4d68-bb13-89fdsf453674" DEVICE="ens160" ONBOOT="yes" IPADDR="192.168.1.1" PREFIX="24" GATEWAY="192.168.1.254" DNS1="114.114.114.114" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_PRIVACY="no" ~ ~ ~ [[email protected] ~]# [[email protected] ~]#
步骤2:重启网卡
[[email protected] ~]# [[email protected] ~]# [[email protected] ~]# service network restart Restarting network (via systemctl): [ 确定 ] [[email protected] ~]# [[email protected] ~]# [[email protected] ~]#
至此,IP地址修改完毕~
时间: 2024-10-11 09:01:08