Linux CentOS 6.5 配置网络

时间:2023-03-10 00:29:57
Linux CentOS 6.5 配置网络

网卡说明

  • 第一块网卡为配置外网:eth0
  • 第二块网卡为配置内网:eth1(没有外网的机器也要将内网配置在第二块网卡上)

1.使用ifconfig查看网卡配置信息

Linux CentOS 6.5 配置网络

2.修改网卡1配置文件/etc/sysconfig/network-scripts/ifcfg-eth0

 # vi /etc/sysconfig/network-scripts/ifcfg-eth0

3.网卡自动获取IP配置,修改ONBOOT=yes即可,service network restart重启网卡。

Linux CentOS 6.5 配置网络

 # service network restart

4.网卡配置静态IP,重启网卡

  BOOTPROTO=static   #启用静态IP地址
  ONBOOT=yes  #开启自动启用网络连接
  IPADDR=192.168.1.113  #设置IP地址
  NETMASK=255.255.0.0  #设置子网掩码
  GATEWAY=192.168.1.1   #设置网关
  DNS1=8.8.8.8 #设置主DNS

Linux CentOS 6.5 配置网络

5.使用ping命令测试是否网卡是否配置成功

Linux CentOS 6.5 配置网络