Dual Nic configuration-summative document

Source: Internet
Author: User
Tags domain name server nameserver dmesg

Early in the morning, a friend said that the dual Nic configuration in the Linux environment, sometimes get the IP address, sometimes cannot get the IP address to change the NIC speed, and now it is normal. But it cannot be used at the same time.

I searched for information on the Internet and wrote a solution as follows:

1. install and configure network devices

When installing Linux, if you have a nic, installProgramYou will be prompted for the TCP/IP network configuration parameters, such as the local IP address, the default gateway IP address, and the dns ip address.

Based on these configuration parameters, the installer will automatically compile the NIC (which must be supported by the Linux system first) driver into the kernel, but we must understand the process of loading the NIC Driver, in the future, we will easily change the NIC when using multiple NICs. The NIC Driver is loaded into the kernel as a module, all Nic drivers supported by Linux are stored in the/lib/modules/(Linux Version)/NET/directory /.
1. Modify the/etc/CONF. Modules File

This configuration file is an important parameter file for Loading modules. Let's take a look at an example file.
Copy content to clipboard
Code:

#/Etc/CONF. Modules

Alias eth0 eepro100

Alias eth1 eepro100
This file is a CONF file in a Linux system with two Inter 82559 series NICs. the alias command indicates the name of the driver of the Ethernet port (such as eth0). Alias eth0 eepro100 indicates that the driver to be loaded on the Ethernet port 0 is eepro100.o. when modprobe eth0 is used, the system automatically loads eepro100.o to the kernel. for PCI NICs, because the system will automatically find the NIC's Io address and interrupt number, there is no need. in modules, use options to specify the NIC's Io address and interrupt number. but corresponding to the ISA Nic, it must be in Conf. the IO address or interrupt number specified in the module, as shown below, indicates the conf of an ISA Nic of NE. modules File
Copy content to clipboard
Code:
R8169
Alias eth0 ne

Options ne IO = 0x300 IRQ = 5
After modifying the conf. Modules file, you can use commands to load the module. For example, you need to insert the second Nic of the Inter.
Copy content to clipboard
Code:
# Insmod/lib/modules/2.2.14/NET/eepro100.o
In this way, you can load the module eepro100.o at the Ethernet port. You can also run the following command to view the information of the currently loaded module:
Copy content to clipboard
Code:
[Root @ ice/etc] # lsmod

Module size used

Eepro100 15652 2 (autoclean)
The returned result indicates that the currently loaded module is eepro100, with a size of 15652 bytes and two users. The returned result is cleared automatically.

2. Modify the/etc/Lilo. conf file.

To initialize the newly added Nic In system initialization, you can modify the Lilo. conf file and add the following command to the/etc/Lilo. conf file:
Copy content to clipboard
Code:
Append = "Ether = 240x300, eth0 ether = x, eth1"
After configuring the network card, you should configure the TCP/IP parameters. In general, you will be prompted to configure the network parameters while installing the Linux system. If you want to modify the network settings, run the following command:
Copy content to clipboard
Code:
# Ifconfig eth0 ***. *** netmask ***.***.***.***
In Linux, we can set multiple IP addresses for one network card, for example, the following command:
Copy content to clipboard
Code:
# Ifconfig eth0: 1 10.1011.218 netmask quota limit 192
Then, run the command # ifconfig-a to view the interfaces of all network interfaces;

In addition, the system's network configuration file is stored in the/etc/sysconfig/network-scripts directory. The example is as follows:
Copy content to clipboard
Code:
Ifcfg-eth0 * ifdown-post * IFUP-aliases * IFUP-PPP *
Ifcfg-eth1 * ifdown-PPP * IFUP-IPX * IFUP-routes *
Ifcfg-Lo * ifdown-sl * IFUP-PLIP * IFUP-sl *
Ifdown @ IFUP-post * network-Functions

The ifcfg-eth0 is the configuration information of the Ethernet port eth0, its content is as follows:

Device = "eth0"/* specify the name of the network device */
Ipaddr = "202.112.13.204"/* specify the IP address of the network device */
Netmask = "255.255.255.255.192"/* specify the network mask */
Network = 202.112.13.192/* specify the network address */
Broadcast = 202.112.13.255/* specify the broadcast address */
Onboot = "yes"/* Indicates whether to activate the NIC when the system starts */
Bootproto = "NONE"/* indicates whether the BOOTP protocol is used */

3. Domain Name Service configuration file
(1) The/etc/hostname file stores the Host Name and domain name of the Linux system. Example file.

Ice.xxxx.cn

This file indicates the host name ice, the domain name is xanet.edu.cn

(2) The/etc/hosts and/etc/networks files are in the Domain Name Service System and have a host table mechanism, /etc/hosts and/etc/networks are the host tables developed to store the Host IP addresses and host names that you do not need to query by the DNS System in/etc/hosts, the following is an example file:

# IP address host name alias

127.0.0.1 localhosts loopback

202.151.3.81 http://www.xxxx.cn/WWW

202.151.3.81 http://www.cnblogs.com/xianqingzh/admin/ftp://ftp.xxxx.cn/ FTP

In/etc/networks, there is a one-to-one correspondence between network IP addresses and network names. Its file format is similar to/etc/hosts.

(3)/etc/resolv. the conf file is the main configuration file of the DNS domain name parser. Its format is very simple. Each line consists of a primary keyword. /etc/resolv. conf keywords include:

Domain specifies the default local domain name,
Search specifies a list of domain names to search for when the host name is searched,
Nameserver specifies the IP address of the Domain Name Server during domain name resolution. An example file is provided below:
#/Etc/resolv. conf
Domain xxxx.cn
Search xxxx.cn
Nameserver 202.151.3.81
Nameserver 202.151.3.81

(4)/etc/host. when both DNS domain name resolution and/etc/hosts host table mechanism exist in the system, the file/etc/host. conf indicates the query order of the parser. the sample file is as follows:

#/Etc/host. conf

Order hosts, bind # The parser query order is file/etc/hosts, and then DNS
Multi on # Allow the host to have multiple IP addresses
Nospoof on # Disable IP Address Spoofing

 

Operating System turbolinux 7.0 dataserver

Symptom:
1: Each network card can be connected and interconnected
2: Internet access failure

The entire operation process:
1: create a dual Nic
Eth0 192.18.2.100
Eth1 192.18.3.100 (Internet)

Gateway 192.18.3.100

Test network card connection

2: Configure ADSL-Setup
2: >;>;>; enter the Ethernet interface connected to the ADSL m
For Solaris, this is likely to be something like/dev/hme0.
For Linux, it will be ethn, where 'n' is a number.
(Default eth1 ):
Eth1
4: The firewall choices are:
>;>;>; Choose a type of firewall (0-2): 0

You can assign an IP address to the ADSL-start instance and ping the gateway.

3: set IP-forward = 1

4: Run iptables-T Nat-A postrouting-O eth1-J masquerade.

5: Ping 203.212.6.173. The network is disconnected.

6: Traceroute-D 203.212.6.173 no route error to the host

\\\

Should the data center be open or closed? | How old are you about IT applications? | Free Top Unix/Linux system cluster course | IT manager's tragic life big exposure survey!
Gentoo

 

No more ADSL-start!
Ifconfig to see if there is any PPP.
 

 

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.

Should the data center be open or closed? | How old are you about IT applications? | Free Top Unix/Linux system cluster course | IT manager's tragic life big exposure survey!
Lobster

You 'd better find a guide on configuring ADSL in Linux.

First, you do not need to start eth1, and do not need to set IP addresses and routes. It is best
File/etc/sysconfig/network-scripts/ifcfg-eth1 content:

Device = eth1
Bootproto = none
Ipaddr =
Onboot = No
Type = Ethernet

Because this Nic is not used by the NIC, it just inserts a line to the ADSL modem. There should be ADSL for management. You should consider it as nonexistent.

It is also the most important

Quote:
4: Run iptables-T Nat-A postrouting-O eth1-J masquerade.

It should not be-O eth1 but ppp0 (If your ADSL is started normally)

For you, eth0 is the Intranet interface, ppp0 is the Internet interface, rather than eth1 (you should not treat it as a NIC ;))

 

View Nic attributes: ethtool-G eth0

2. Tools for viewing hardware information in Linux;

In Linux, there is no tool to view the hardware chip information. It should be said that the Linux tool can view the hardware information more clearly. The following describes several common tools; the most commonly used tool is lspci; the other tools are just a bit of knowledge;
1. lspci lists all PCI devices;
Lspci-list all PCI devices, mainly used to list PCI devices on the machine, such as sound cards, video cards, cats, and NICs. The integrated motherboard devices can also be listed. lspci reads the hwdata database, hwdata is provided by the software package hwdata;

To bind an IP address to a Linux dual-nic
Time: Source: Author: Click: Times
A professional Linux technology website with users all over the country. It has a large number of Linux experts and engineers who collect a large amount of Linux information and is an online home for Chinese Linux users.
(Responsible editor: yiteng Technology)
Original: black bug Linux Space

1. New/etc/sysconfig/network-scripts/ifcfg-bond0 File
Device = bond0
Onboot = Yes
Bootproto = none
Ipaddr = 192.168.128.225
Netmask = zookeeper
Gateway = 192.168.128.233
Userctl = No

2. Change/etc/sysconfig/network-scripts/ifcfg-eth0 Nic Properties
Device = eth0
Onboot = Yes
Bootproto = none
Master = bond0
Userctl = No

3. Change the properties of the/etc/sysconfig/network-scripts/ifcfg-eth1 Nic
Device = eth1
Onboot = Yes
Bootproto = none
Master = bond0
Userctl = No

4. Edit the/etc/modprobe. conf file and add the following content:
Alias bond0 Bonding
Options bond0 miimon = 100 mode = 0

5. Add the/etc/rc. d/rc. Local startup Item.
Ifenslave bond0 eth0 eth1

6. Start the NIC
Ifconfig bond0 192.168.128.225 up
Ifenslave bond0 eth0 eth1

Note: After completing the preceding steps, you must restart the computer. As bonding needs to load the driver, the Environment passes the centos4.5 test.

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.