How to configure multiple NICs in Linux

Source: Internet
Author: User
Article Title: how to configure multiple NICs in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Maybe you want to use your Linux as a vro like me. maybe your company's network is too large and you need a vro to improve efficiency, but I don't want to invest in a professional routing device. In this case, linux is very helpful. Then you will encounter a problem immediately. how can you enable your linux to support more than two NICs?
Linux kernel can only detect one network card. to detect more than two network cards, we need to configure the kernel module. Fortunately, the current kernel, generally, the driver is used as a module. That is, when the kernel is activated, let the module automatically detect the installed Ethernet. if we use a PCI Nic, all these actions will be automatically completed by the kernel. However, if we are using an ISA Nic, the kernel may not be able to detect your nic. in this case, we need to manually set the NIC. we need to specify the Nic IO address, so that the module can detect the Nic directly at the specified IO address. Therefore, we need to put the information in/etc/conf. the following examples are provided in the modules file:
Assume that you have two ISA NE2000 NICS, which are generally set to non-PnP. If your network adapter is a jumper, you can directly move the jumper header on your network adapter. if your network adapter is a soft jumper (usually a soft jumper ), first, you should use your Nic to drive the disk. in dos (I used a: setup.exe to set the NIC), set the IO and IRQ values of the two NICs, it must pass the detection.
For example, I/O = 0x300, IRQ = 10
The other one is: IO = 0x240, IRQ = 3
In addition, both settings can run normally. Now, go to linux and edit the/etc/conf. modules file. the content is as follows:
---------------
Alias eth0 ne
Alias eth1 ne
Options ne io = 0x300, 0 x
---------------
What does this mean? When ne. when the o module (in the/lib/modules/2.2.5-15/net directory) is loaded by the kernel, the module knows the IO address to find the NIC, note that 0x is in hexadecimal format. Generally, I/O addresses are expressed in hexadecimal notation.
Now, your two NICs can be configured. Please reboot Your linux and pay attention to your activation information, especially the line before the process manager init is activated, you can see the following content:
-------------
Ne. c: v1.0 9/23/94 Donald Becker
NE * 000 ethercard probe at 0x300: 00 AE 25 01 c7 6b
Eth0: NE2000 found at 0x300, using IRQ 10.
NE * 000 ethercard probe at 0x240: 00 00 21 5a 00 07
Eth1: NE2000 found at 0x240, using IRQ 3.
-------------
If you miss it during activation, you can enter dmesg | more. :-)
Generally, most ISA NICs can use commas to separate the two I/O addresses, so that the module can automatically detect them, but some NICs won't work, such as the ec501.o module of 3com, when the module is loaded by the kernel, only one network card can be detected. in this case, you should load the module twice so that both network cards can be detected. the following configuration module:
--------
Alias eth0 3c501
Alias eth1 3c501
Options eth0-o 3c501-0 io = 0x280 irq = 5
Options eth1-o 3c501-1 io = 0x300 irq = 7
--------
In this example,-o is a unique module name. Only in this way can the module load irq twice in the kernel = specify the Nic interrupt value. But if you use two different NICs, what should you do? Example:
One network card is 3c503 IO value: 0x350
The other one is: NE2000 IO value: 0x280
The configuration file of the module is as follows:
----------
Alias eth0 ne
Alias eth1 3c503
Options ne io = 0x280
Options 3c503 io = 0x350
----------
If your Nic is a PCI Nic, it will be much easier. you only need to associate ethN with the specified driver module on the alias line, i/O-based PCI NICs are easily detected. The available driver modules are in the following Directory:/lib/modules/'uname-r'/net. Note that uname-r refers to the version number of your Linux kernel, for example, 2.0.34 or 2.2.5-15, and my kernel is 2.2.5-15, these driver modules are in the/lib/modules/2.2.5-15/net directory. Once you have configured your conf. modules file, you can use the following command to detect it:
Modprobe ethN
Dmesg | tail
'N' indicates the network card number. if you compile the driver module of the network card into the kernel, you can only detect one network card, the Linux kernel can detect only one Nic by default.
There are generally two ways to activate the second, third, and fourth Enis when the kernel is activated.
One method has been introduced above, and another method is introduced below. This method is a traditional method, that is, when the kernel is not modular. Generally, some parameters are added when LILO activates the kernel, such:
LILO: linux ether = 300x240, eth0 ether =, eth1
For more information about LILO activation parameters, see BootPrompt-HOWTO.
In order not to enter too long parameters for each activation, we can use the append = command to configure lilo. conf as follows:
Append = "ether = 10, 0x300, eht0 ether = 3, 0x240, eth1"
If you use loadlin.exe in the dossystem to activate your Linux instance, let's look at the following example:
Loadlin zImage root =/dev/hdb1 ro ether = 10, 0x300, eht0 ether = 3, 0x240, eth1
Install more than two NICs in linux. this is usually the two common methods, but there is another method. We do not recommend that you directly edit the Space. in the c file, change 0xffe0 to 0x0. 0xffe0 indicates that the device is not detected. if it is changed to 0, the device is automatically detected.
  
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.