Linux Server NIC Driver Installation and troubleshooting (figure)

Source: Internet
Author: User
Article Title: Linux Server NIC Driver Installation and troubleshooting (figure ). 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.
   3. Set an IP address for the new Nic
  
An alias is assigned to a Linux network device during configuration. The alias consists of a descriptive acronyms and a number. The first device of a certain type is numbered 0, and other devices are numbered 1, 2, 3, and so on. However, the NIC is not the most bare device in the/dev directory, but in the memory. Eth0 and eth1 are Ethernet interfaces. They are used for most Ethernet cards, including many parallel port Ethernet cards. This article mainly discusses this type of Nic. You can set an IP address for a Linux Ethernet card in a very flexible way. You can choose a method suitable for your work:
  
(1) Use the ip address or ifconfig command
  
The ifconfig command is the most important Linux network command. The main purpose is to set and modify the IP address of the nic and the IP address of the NIC:
  
# Ifconfig eth0 192.168.0.2 netmask 255.255.255.0
  
By default, ifconfig displays active network devices. Add a-a switch to this command to view all devices. However, the ifconfig command sets the IP address of the network device. After the system restarts, the setting will automatically fail. Therefore, it is mainly used for Nic status debugging. Suppose you want to create a temporary network configuration for testing. You can use the tool in the release version to edit the configuration, but note that after the test is completed, all the settings are restored. By using ifconfig, we can quickly configure the NIC without affecting the saved settings.
  
The Ip command is a powerful network configuration tool in the iproute2 software package. It can replace some traditional network management tools. For example, ifconfig and route. Currently, most Linux distributions and most UNIX use the old arp, ifconfig, and route commands. Although these tools can work, they seem outdated in Linux and later. Before using iproute2, you should confirm that this tool has been installed. The package name is called "iproute2" in RedHat Linux 9.0, or you can download the source code installation in: ftp://ftp.inr.ac.ru/ip-routing.
  
If you want to add an address 10.0.0.1 to the Ethernet interface eth0, the mask length is 24 bits, the standard broadcast address, and the label is eth0: Alias:
  
# Ip addr add 10.0.0.1/24 brd + dev eth0 label eth0: Alias
  
(2) Use the netconfig command
  
The netconfig command can be used to set the IP address of a network device. The netconfig command can be used to permanently Save the settings.
  
Use "netconfig ethX ". After the "netconfig eth0" command is run, a dialog box is displayed on the command line. You can see the settings,
    
Netconfig configuration page
  
After the setting is complete, press "tab" and select "OK" to save the setting and exit. Then run the command "service network restart" to activate the service.
  
(3) Use the neat command
  
To use the neat command, you must configure the X window System. Run the "neat" command on the command line, add the IP address and other related parameters, and save the settings. Restart the network and network service or computer, see figure-3.
  
Figure-3 add an IP address to the graphic interface
  
In addition, the neat command also has the same price command: "redhat-config-network", which is exactly the same. The Neat and redhat-config commands can permanently Save the settings.
  
(4) modify the TCP/IP network configuration file
  
Unless otherwise specified, most configuration files in Red Hat Linux are in the/etc directory. The NIC-related TCP/IP network configuration file is:/etc/sysconfig/network-scripts/ifcfg-ethx. Where x starts from 0, the first Ethernet configuration file is:/etc/sysconfig/network-scripts/ifcfg-eth0. You can use the vi editor to modify the file or the IP address of the NIC.
  
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
  
DEVICE = eth0 # Set the network card name, which must correspond to the file name #
ONBOOT = yes # Whether to enable the NIC at startup #
BOOTPROTO = static # The protocol obtained by the IP address at startup, which is fixed here,
If it is a dynamic host, it must be changed to dhcp #
IPADDR = 192.168.1.2 # IP address #
NETMASK = 255.255.255.0 # subnet mask #
NETWORK = 192.168.1.0 # The first IP address of the NETWORK segment #
BROADCAST = 192.168.1.255 # BROADCAST address of the last same network segment #
GATEWAY = 192.168.1.2 # GATEWAY address #
# GATEWAYDEV = eth0
  
After saving the disk, run the command "service network restart" to activate it. This method can also save settings permanently.
  
(5) add an IPV6 address for the NIC
  
Compared with Windows systems, Linux provides better Ipv6 support. The first Linux kernel that supports Ipv6 is 2.2.xxx. Generally, Ipv6 can be used directly for Linux versions based on the 2.4 kernel. Before using IPv6, you must check whether the system Ipv6 module is loaded. If not, you can use commands to manually load the system, this requires the permissions of the Super User. Run the command to check whether the IPv6 address (inet6 addr: fe80: 200: e8ff: fea0: 2586/64) indicates that IPv6 has been loaded.
  
# Modprobe IPv6; # ifconfig-
  
If you want to automatically load the Ipv6 module when the Linux system starts, you can add a line in the configuration file:/etc/modules. conf:
  
Alias net? Pf? 10 ipv6 # automatically load IPv6 module on demand
  
   4. Adjust the NIC Working Mode
  
Currently, most network interfaces work in adaptive mode. When configuring network interface parameters, we seldom consider the network interface mode. Sometimes we find that some network interface modules have been loaded, but they are unstable in some modes. For example, I use a miscellaneous brand of XXX.
  
The TL-8139C chip 10/100 adaptive Nic is extremely unstable at 100 megabits Duplex (9.12% packet loss rate during Qcheck TCP and UDP testing .). In Linux, we can use the mii-tool command provided by the system to configure the NIC working mode. Display All the ethernet card types supported by the Linux Server Nic. Run the following command:
  
# Mii-tool-v
Eth0: negotiated 100baseTx-FD, link OK
Product info: vendor 00:00:00, model 0 rev 0
Basic mode: autonegotiation enabled
Basic status: autonegotiation complete, link OK
Capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
Advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
Link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  
From the above information, we can see that this network card works in 100 Full Duplex adaptive mode, "100aseTx-FD" means 100 M Full Duplex. Here, you can force the NIC to work in M half-working mode and enter the command:
  
# Mii-tool? F 100baseTx-HD eth0
  
To recover the adaptive working mode of the network adapter in the future, enter the following command:
  
# Mii-tool? R eth0
  
In addition, the correct working mode should be specified for routers, switches, proxy servers, and other key devices with large traffic, which can improve the communication efficiency.
  
   5. DHCP Client Nic settings
  
If you want to use DHCP as a Dynamic Host Configuration Protocol, this protocol is used to automatically provide IP addresses, subnet masks, and routing information to your computer. When devices access this lan, they will request an IP address from the DHCP server. The DHCP server then assigns an IP address to each requested device until all IP addresses in the specified range are allocated. The allocated IP address must be regularly extended. This extension process is called leasing, which ensures that the allocated address can be returned to the server when the client device suddenly disconnects from the network before the IP address is released normally. There are two ways to configure the DHCP Client in Linux: graphical interface and manual configuration. You can use the neat command interface on the GUI. Select "automatically obtain IP Address Settings and use DHCP.
  
I usually prefer to manually configure DHCP clients. You need to modify the/etc/sysconfig/network file to enable the networking; modify the configuration file of each network device in the/etc/sysconfig/network-scripts directory. In this directory, each device has a configuration file named ifcfg-ethX, which is the name of the network device. Such as eth0. If you want to enable NETWORKING during boot, the NETWORKING variable must be set to yes. Except here, the/etc/sysconfig/network file should contain the following lines:
  
NETWORKING = yes
DEVICE = eth0
BOOTPROTO = dhcp
ONBOOT = yes
  
   6. VPN Server Nic settings
  
VPN is a secure communication tunnel established on the Internet by authorized communication parties. Data is encrypted in the tunnel for secure communication between Headquarters and branches. Virtual Private Network is a new network technology used to securely access the enterprise network over the Internet or LAN. In Redhat Linux, the VPN technology mainly includes CIPE (Crypto IP Encapsulation: encrypted IP Encapsulation), which is mainly developed for Linux. CIPE uses encrypted IP groups. These groups are encapsulated or "surrounded" in the datagram (UDP) group. The CIPE group is given the target header information and encrypted using the default CIPE encryption mechanism. CIPE uses standard Blowfish or IDEA encryption algorithms to support encryption. Depending on the Encryption Export Regulations in your country, you can use the default method (Blowfish) to encrypt all the CIPE traffic on your private network. The CIPE configuration can be completed through text files and graphical network management tools. This section uses a text file as an example. First, install the CIPE software on the server and client. Official Website: http://sites.inka.de /~ To run the cipe vpn service, you must create two files:/etc/sysconfig/network-scripts/ifcfg-cipcbX and/etc/cipe/options. cipcbX. X is an incremental number starting from 0.
  
(1) VPN Server Nic settings
  
First, manually create the/etc/sysconfig/network-scripts/ifcfg-cipcb0 file, it is the virtual network interface of the VPN Server, the main content:
  
USERCTL = yes # whether to allow all users to modify the configuration #
TYPE = CIPE # interface TYPE #
DEVICE = cipcb0 # name the cipe device #
ONBOOT = yes # activate the device when the system starts #
IPADDR = 10.0.0.1 # local virtual address #
MYPORT = 7777 # communication port #
PTPADDR = 10.0.0.2 # remote virtual address #
PEER = 0.0.0.0 # local address, 0.0.0.0 indicates accepting continuous listening #
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.