The network configuration method of Linux

Source: Internet
Author: User
Tags network function

From the day Linux was born, it was destined for its network function is unprecedented powerful. So how to configure the network in the Linux system, so that it is efficient, safe work is very important. Below we will install from the network device, Network Service settings and network security three aspects to introduce the Linux system in the network settings.

When Linux is installed, if you have a network card, the installer will prompt you for the configuration parameters of the TCP/IP network, such as the IP address of the computer, the IP address of the default gateway, the IP address of the DNS, and so on. Depending on these configuration parameters, the installer will automatically connect the network card (Linux system first) The driver is compiled into the kernel. However, we must understand the load card driver process, then change the network card in the future, the use of multiple network card when we will be very easy to operate. The driver for the NIC is loaded into the kernel as a module, and all Linux-supported NIC drivers are stored in the directory/ lib/modules/(Linux version number)/net/, for example, Inter's 82559-series 10/100m Adaptive Boot adapter driver is eepro100.o,3com 3c509 the driver for the ISA network adapter is 3C509.O, The driver for the DLink PCI 10 network adapter is the via-hine.o,ne2000 compatibility NIC driver is NE2K-PCI.O and NE.O. After understanding these basic drivers, we can change the NIC or increase the network card by modifying the module configuration file.

1. Modify the/etc/conf.modules file

This configuration file is an important parameter file to load the module, we first look at an example file

#/etc/conf.modules

Alias Eth0 eepro100

Alias Eth1 eepro100

This file is content in Conf.modules in a Linux system with two inter 82559 series network cards. The alias command indicates the name of the driver that is in Taikou (such as Eth0), alias Eth0 Eepro100 that the driver to be loaded at the 0th Ethernet port is eepro100.o. When you use the command modprobe eth0, the system automatically loads the EEPRO100.O into the kernel. For PCI network adapters, Because the system will automatically find the IO address and interrupt number of the NIC, there is no need to use option options in Conf.modules to specify the IO address and interrupt number of the NIC. However, for the ISA network adapter, you must specify the IO address or interrupt number of the hardware in the conf.modules. As shown below, indicates the conf.modules file of a NE ISA network card.

Alias Eth0 NE

Options NE io=0x300 irq=5

After you modify the Conf.modules file, you can use the command to load the module, such as the second network card to insert the Inter:

#insmod/LIB/MODULES/2.2.14/NET/EEPRO100.O

This allows the module EEPRO100.O to be loaded at the Ethernet port. At the same time, you can also use commands to view the currently loaded module information:

[root@ice/etc]# Lsmod

Module Size Used by

eepro100 15652 2 (AutoClean)

The meaning of the return result is that the currently loaded module is eepro100, the size is 15,652 bytes, the user is two, and the method is automatically cleared.

2. Modify the/etc/lilo.conf file

In some newer versions of Linux, the/etc/lilo.conf file does not need to be modified because the operating system automatically detects all the relevant hardware. But for the ISA network card and the old version, in order to initialize the new NIC in system initialization, You can modify the lilo.conf file. Add the following command in the/etc/lilo.conf file:

append= "Ether=5,0x240,eth0 ether=7,0x300,eth1"

The meaning of this command is that eth0 IO address is 0x240, interrupt is 5,eth1 IO address is 0x300, interrupt is 7.

In fact, this statement comes from parameters that are passed when the system boots the image file.

Lilo:linux Ether=5,0x240,eth0 ether=7,0x300,eth1

This approach also allows the Linux system to configure two network adapters. Similarly, you can follow the same method when using more than three network adapters.

After configuring the NIC, you should configure TCP/IP parameters, and in general, you will be prompted to configure the network parameters while installing the Linux system. But then if we want to modify the network settings, we can use the following command:

#ifconfig eth0 a.b.c.d netmask e.f.g.h

A.B.C.D is the IP address of eth0, E.f.g.h is a netmask.

In fact, we can set up multiple IP addresses for a network card in a Linux system, such as the following command:

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.