Linux系统下配置网关

讲解Linux系统下配置网关的基本操作,以CentOS 7 64位系统为例

检查虚拟网卡这个硬件设备

①:查看虚拟网卡这个硬件设备具体型号

1
[root@localhost]# lspci |grep Ethernet

Ethernet

可以查看到该主机网卡为Intel 82545EM 千兆以太网卡

②:查看目前网卡驱动程序版本信息

1
2
[root@localhost]# ethtool -i ethx
[root@localhost]# ifconfig eth0

提示:eth0: error fetching interface information: Device not found
判断应该是没有安装网卡驱动

安装网卡驱动

①:前往Intel官网下载Intel 82545EM 千兆以太网卡驱动程序,http://www.intel.cn

drive

②:下载完成后,依次执行命令解压安装驱动包

1
2
[root@localhost]# tar zxf e1000-8.0.35.tar.gz
[root@localhost]# cd e1000-8.0.35/src/ && make install

注:此驱动程序为源代码的程序包,安装前确认系统kernel-headers、kernel-firmware、kernel-devel三个软件包已经安装,且版本一定要相同,以及编译工具gcc、gcc-c++已经安装,如果没有安装,请配置正确的yum源后使用yum命令来安装

配置网络

①:查看路由表

1
[root@localhost]# route -n

②:发现里面并没有我想要的网关,所以就要添加一个

1
[root@localhost]# route add 10.10.88.203 dev eth0

③:重启network

1
[root@localhost]# service network restart