一、临时设置IP地址
ifconfig eth0 192.168.42.119 broadcast 192.168.42.129 netmask 255.255.255.0
二、上述方法只能临时生效,需要永久生效需要配置文件,
配置/etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.42.119
GATEWAY=192.168.42.119
DNS1=114.114.114.114
NETMASK=255.255.255.0
时间: 2024-12-26 10:04:36