Linux Nic installation and ip configuration

Source: Internet
Author: User
Linux Nic installation and ip configuration-general Linux technology-Linux technology and application information. For more information, see. 1. Check whether the new Nic has been detected by the core:
# Dmesg | grep-in eth # Check whether the NIC is captured by the core and the module name (r8168). If not, compile the module. If it is captured, find the NIC code and write the module and nic code to/etc/modprobe. in conf, enable it to start # vi/etc/modprobe. how to modify or add the conf file? One line! Alias eth0 r8168

[Lspci | grep 'eth '// indicates the hardware used to search for PCI slots in the LAN. If this hardware is used, the driver is not installed.
If: 02: 00.0 Ethernet controller: Realtek semiconduco ., ltd. RTL8811/8168B PCI Express Gigabit Ethernet controller (rev 02) or similar information indicates that this Nic exists, but the NIC driver is not installed or the driver version is incorrect, download the RTL8811/8168B NIC Driver to compile the module.]


2. Download and compile the NIC Driver


1) Prerequisites: You need to install components such as gcc, make, and kernel-devel. These components are available on the CD. You can mount the CD to install the corresponding rpm package.

2) Check the Linux kernel version uname-r.
3) download the driver of the corresponding version,

For example, my kernel is 2.6.18-53. e15xen.
Then download the corresponding NIC Driver http://www.realtek.com.tw/downloads/?communications network ICs --> "Network Interface Controller" --> "10/100/100 M Gigabit etemedinet" --> "PCI Express" --> "Software 』, click the (Unix/Linux) project, and then click the "for kernel 2.6.x" project to download it smoothly! R8168-8.018.00.tar.bz2 [intel Nic to http://downloadcenter.intel.com/Default.aspx? Lang = zho download]
RTL8111B/RTL8168B/RTL8111/RTL8168/RTL8111C/RTL8111CP/RTL8111D (L)/RTL8168C/RTL8111DP/RTL8111E/RTL8105E
Support for LINUX driver for kernel 2.6.x and 2.4.x (Support x86 and x64)
Download driver package: r8168-8.016.00.tar.bz2
4) copy the file to the linux system through a USB flash drive for compilation
Mount the USB flash drive
Mkdir/mnt/usb
Mount/dev/sda1/mnt/usb-t vfat
For example, to copy the driver of the USB flash drive to the/root directory

# Cd/usr/src

# Ln-s kernels/2.6.18-194.11.1.el5-i686/linux (in general, for Versions later than Linux kernel 2.6, the original core code is stored in the/usr/src/kernels/(version) directory by default. However, the older General Program assumes that the original core code is in/usr/src/linux, therefore, we must first perform an operation to link the source code to/usr/src/linux)

[Root @ www src] # tar-jxvf/root/r8168-8.018.00.tar.bz2-C/usr/local/src

[Root @ www ~] # Cd/usr/local/src/r8168-8.018.00/


Compile and install the startup service. Here he provides a scripts


[Root @ www r8168-8.018.00] #. /autorun. sh (this script will actively compile, uninstall, and install modules in the/lib/modules/$ (uname-r)/kernel/drivers/net directory, and try to load this module and start the network card.


If you do not have this script, make clean modules, make, and install it on your own.


The core of kernel 2.6 is to use the. ko extension! So what we need is this file.

[Root @ www r8168-8.018.00] # cp-a src/r8168.ko/lib/modules/$ (uname-r) /kernel/drivers/net the entire network card driver module is placed in the directory above

[Root @ www r8168-8.018.00] # depmod-a re-analyzes all modules! Create connected File

[Root @ www r8168-8.018.00] # modprobe r8168 start to load r8168 Module

[Root @ www r8168-8.018.00] # lsmod | grep r8168 if the relevant words run out, it indicates that this module can be smoothly loaded
Write the module and nic code to/etc/modprobe. conf and enable it to start the system. # Change vi/etc/modprobe. conf or add the following code? One line! Alias eth0 r8168

5) restart and set the IP address

**************************************** **************************************** **********************

# Netconfig/# Enter the directory configuration if you try netconfig.

1. Modify the IP address file and Gateway:

/Etc/sysconfig/network-scripts/ifcfg-eth0

Static settings:

DEVICE = eth0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.1.181
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.252
HWADDR = 00: 0C: 29: A0: BE: A1

Dynamic settings:

DEVICE = eth0
ONBOOT = yes
BOOTPROTO = dhcp
HWADDR = 00: 0C: 29: A0: BE: A1

Ii. Modify DNS:

/Etc/resolv. conf


Search localdomain

Nameserver 58.60.188.178

3. Restart the Network Configuration:

Service network restart

4. enable/disable the Firewall:

Service iptables start/stop

Service iptables on/off
Related Article

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.