RedHat静态Ip地址配置
依次修改以下4个文件:
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf
/etc/hosts
1./etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
GATEWAY=192.168.8.1
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
GATEWAY=192.168.8.1
2./etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:0c:29:6f:3b:35
NETMASK=255.255.255.0
IPADDR=192.168.8.4
GATEWAY=192.168.8.1
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:0c:29:6f:3b:35
NETMASK=255.255.255.0
IPADDR=192.168.8.4
GATEWAY=192.168.8.1
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
3./etc/resolv.conf
search localdomain
nameserver 192.168.8.1
nameserver 192.168.8.1
4./etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
192.168.8.6 redhat.localdomain redhat
--IP地址 主机名.域名 主机名 (192.168.8.6 redhat.localdomain redhat)
5.重启生效
使IP地址生效:
/sbin/ifdown eth0
/sbin/ifup eth0
通知网关更新信息:
/etc/init.d/network restart