zhitao2072的个人空间 https://bbs.21ic.com/?898583 [收藏] [复制] [RSS]

日志

Ubuntu系统如何安装双网卡及更改网卡名称(eth0改为eth1) (转载) ...

已有 613 次阅读2015-5-21 11:09 |系统分类:通信网络| ubuntu, 服务器, 新网, 如何, 网卡

最近,在原来的ubuntu服务器上安装两块千兆网卡,需要用到了一些网卡的安装、配置及更改命令。

新安装的网卡为PCI-E 1x 接口,芯片为“BROADCOM 5721”;服务器为IBM 3650 M2,Ubuntu系统采用的是10.04 版本。安装好网卡以后启动服务器,使用“lspci”命令查看服务器PCI设备,看看是否正确识别出新网卡。我的服务器识别出了新网卡,说明Ubuntu系统带有该网卡的驱动,不必手动安装驱动。识别出新网卡后,即可对其进行配置。

此时新网卡的名称应该为“eth2”和“eth3”,因为“eth0”和“eth1”被服务器原有的网卡占用了。服务器启动完毕以后,使用“ifconfig”命令,看到的却是“eth0”、“eth0_rename”、“eth1”和“eth2”,并且原有两块“eth0”和“eth1”网卡无**常工作。看来必须对服务器上的四块网卡重新进行设置。

1)用“ifconfig”命令查看并记录下四块网卡的MAC地址;

2)vi /etc/udev/rules.d/70-persistent-net.rules

3)上面的文件内容与下面类似

# This file was automatically generated by the /lib/udev/write_net_rules

# program run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single line.

 

# PCI device 0x8086:0x10c0 (e1000e)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1a:a0:9d:f2:58", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" 

其中,NAME="eth0"就是网卡的名称,该名称与MAC地址"00:1a:a0:9d:f2:58"对应。通过编辑该文件,就可以调整网卡名称。

4)更改完后重启服务器。

5)服务器启动完毕以后,编辑网卡配置文件。

“sudo vi /etc/network/interfaces”

以下是推荐配置

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

auto eth0   #设置eth0

iface eth0 inet static

   address 192.168.10.10

   netmask 255.255.255.0

   network 192.168.10.0

   broadcast 192.168.10.255

   gateway 192.168.10.1

   dns-nameservers 202.103.224.68

   dns-nameservers 202.103.225.68

 

auto eth1   #设置eth1

iface eth1 inet static

address 10.45.56.8

netmask 255.255.255.0

network 10.45.56.0

broadcast 10.45.56.255

以下略.......

6)设置完后重启网络

      sudo /etc/init.d/networking restart


路过

鸡蛋

鲜花

握手

雷人

评论 (0 个评论)