linux_修改ip(重启后永久生效)

时间:2022-07-02 22:42:50
  • vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
TYPE=Ethernet
UUID=a20869f2-4095-4e5d-9b0c-9a5aa7b8b750
ONBOOT=yes 开机启动
NM_CONTROLLED=yes
BOOTPROTO=none ip方式:dhcp static none
HWADDR=00:0C:29:9E:B4:51 mac地址 可删除
IPADDR=192.168.158.151 ip地址 局域网不可重复
PREFIX=24 子网掩码 netmask 255.255.255.0 点分十进制
GATEWAY=192.168.158.2 网关
DNS1=192.168.158.2 dns
DOMAIN=114.114.114.114 dns
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"