分享

[笔记]ubuntu11.10下添加网卡

 antyoung 2012-04-26

1、使用lspci查看是否有驱动,显示结果类似:

Ethernet controller: Intel Corporation 82562V-2 10/100 Network Connection

Ethernet controller: D-Link System Inc DGE-530T Gigabit Ethernet Adapter

其中,第一行所显示的网卡是系统原有的集成网卡,第二行所显示的网卡是新添加的D-Link网卡。如果仅有一行Ethernet信息,则说明新添加的网卡没有加载,需要手动安装驱动程序。
2、新网卡添加后,即可对其进行配置。

注意,此时新网卡的名称时eth1,因为eth0被原有的网卡占用。如果想将新网卡设置为eth0,则需要进行以下步骤。

1ifconfig eth0ifconfig eth1查看网卡的MAC地址并记录,MAC地址主要用来区分两块网卡;

2vi /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"

 

# PCI device 0x1186:0x4b01 (skge)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:26:5a:81:9f:e7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

其中,NAME="eth0"就是网卡的名称,该名称与MAC地址"00:1a:a0:9d:f2:58"对应。只要更改eth0eth1,就可以将MAC地址为"00:1a:a0:9d:f2:58"的网卡从eth0变成eth1.
3、对网络进行设置,可以编辑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.37.76

   netmask 255.255.255.0

   network 192.168.37.0

   broadcast 192.168.37.255

   gateway 192.168.37.254

   dns-nameservers 192.168.37.254

 

#auto eth1   #设置eth1

#iface eth1 inet static

#address xxx

 

#auto eth0:1   #单网卡设置多个IP

#iface eth0:1 inet static

#address 192.168.1.60

#netmask 255.255.255.0

#network x.x.x.x

#broadcast x.x.x.x

#gateway x.x.x.x

4、设置完后重启网络:/etc/init.d/networking restart

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多