centos换IP地址需要修改的文件
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf
/etc/hosts
以下是我的设置
/etc/sysconfig/network
这里主要是指定了网关
NETWORKING=yes
HOSTNAME=localhost.localdomain
/etc/sysconfig/network-scripts/ifcfg-eth0
这里主要指定IP获得方式(static),ip地址,子网掩码,网络类型
# Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express
DEVICE=eth0
#BOOTPROTO=dhcp
BOOTPROTO=static
IPADDR=192.168.1.21
NETMASK=255.255.255.0
TYPE=Ethernet
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
/etc/resolv.conf
指定DNS
search localdomain
nameserver 192.168.1.1
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf
/etc/hosts
以下是我的设置
/etc/sysconfig/network
这里主要是指定了网关
NETWORKING=yes
NETWORKING_IPV6=no
GATEWAY=192.168.1.1HOSTNAME=localhost.localdomain
/etc/sysconfig/network-scripts/ifcfg-eth0
这里主要指定IP获得方式(static),ip地址,子网掩码,网络类型
# Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express
DEVICE=eth0
#BOOTPROTO=dhcp
BOOTPROTO=static
IPADDR=192.168.1.21
NETMASK=255.255.255.0
TYPE=Ethernet
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
/etc/resolv.conf
指定DNS
search localdomain
nameserver 192.168.1.1