1.配置静态的IP,网关,DNS,子网掩码
(1)IP,子网掩码
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.2.81
NETMASK=255.255.255.0
NETWORK=192.168.2.0
GATEWAY=192.168.2.254
DNS1=218.2.135.1
DNS2=8.8.8.8
(2)配置主机名及IP映射
# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=centos01
#vi /etc/hosts
Y.Y.Y.Y centos01
2.动态配置DHCP
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0C:29:BA:6D:9C
PEERDNS=yes
PEERROUTES=yes
LAST_CONNECT=1388439949
CentOS:配置静态IP,主机名,网关等。
最新推荐文章于 2024-08-17 00:21:55 发布