ArticleDirectory
- NIC Driver
- Nic configuration file
- Configure Nic Information
- Several Common commands
- MII-tool usage
- IP
- Nic Load Testing Tool
In Linux, NICs are not as well supported as windows, and sometimes need to be done by yourself. This article summarizes the related driver installation, command line tool, and nic load testing.
NIC Driver
Http://downloadcenter.intel.com/
The readme commands in the installation package are described in detail as follows:
Make install
Modprobe e1000e or insmod e1000
Rmmod e1000e; modprobe e1000e
Nic configuration file
Nic information is usually configured with IP addresses, subnet masks, and gateways. The NIC information is saved in the NIC configuration file. The NIC configuration file is located in the/etc/sysconfig/network-scripts directory. A Nic corresponds to a NIC configuration file. The configuration file naming rules are as follows:
Ifcfg-network card type and network card serial number
Since the ethernet card type is Eth, the serial number of the network card starts from 0, so the configuration file name of the first network card is called the ifcfg-eth0, the second network card is the ifcfg-eth1, and so on.
Common configuration file names in Nic configuration files are as follows:
Device = eth0, define thisNic Identification name.
Bootproto = DHCP, start the identification name of the NIC.
Static/NONE: represents a fixed IP address; Bootp/DHCP: obtains an IP address through the bootp or DHCP protocol.
Hwaddr = 00: 02: B3: 0b: 64: 22, the MAC address of the NIC.
Onboot = Yes, whether to enable the network adapter when starting the network service. When the RedHat system starts the network service, the network service reads all the NIC configuration files stored in the/etc/sysconfig/network-scripts/directory at a time. If onboot In the NIC configuration file is set to yes, the network service calls the IFUP command to start the NIC. If the onboot parameter in the NIC configuration file is no, the Network skips the start of this Nic.
Type = Ethernet, network card type.
Userctl = No, whether to allow normal users to start or stop the NIC.
Ipv6init = No, whether to enable the IPv6 function on the NIC.
Peerdns = Yes, whether to allow the NIC to query DNS information from the DHCP server at startup, and automatically overwrite the/etc/resolv. conf configuration file.
The following configuration items are used to specify the static IP address of the NIC. At this time, bootproto must be static or none.
Ipaddr = 192.168.1.55. Specify the IP address of the NIC in static mode.
Netmask = 255.255.255.0, which defines the subnet mask of the network card.
MTU = 1500, set the maximum transmission unit of the MAC frame of the NIC.
Gateway = 192.168.1.1. Set the default gateway of the network.
Dns1 = 192.168.128.5. Specify the primary DNS server address.
Dns2 = 192.168.128.6: Specify the address of the backup DNS server.
Configure Nic Information
You can directly modify the related content in the NIC configuration file to configure Nic information. However, this method has high requirements for users. The three commands used in RedHat Enterprise linux5 to set IP addresses are system-config-network, setup, and ifconfig. The method for setting IP addresses in ifconfig is described in the Common commands section.
(1)System-config-networkCommand
Enter the system-config-network command in the command prompt line to start the visual network configuration interface (this method is relatively simple for beginners)
(2)SetupSet Nic Information
After entering the setup command in the command line, the system settings page is displayed. Then, select Nic settings to enter the NIC settings page (many systems can use the setup command to set the NIC settings, which is widely used)
(3)IfconfigCommon Nic commands
The ifconfig command is powerful and can be used to view and set Nic information.
A. View Nic Information
Command syntax: ifconfig [parameters]
Parameter description:
No parameter: displays the active Nic
-A: displays the configuration information of all NICs in the system.
Nic device name: displays the configuration information of the specified Nic
Eg: View eth0 Nic information: # ifconfig eth0
B. Set the IP address
Command syntax: ifconfig Nic device name IP address netmask Subnet Mask
(Note: the IP address set by the ifconfig command takes effect immediately, but after the machine is restarted, the IP address is returned to the original IP address. Therefore, the ifconfig command can only be used to set a temporary IP address)
Eg: ifconfig eth0 192.168.168.156 netmask 255.255.255.0
C. Modify the MAC address
Command syntax: ifconfig Nic device name HW ether MAC address
(Note: Enable the NIC before modifying the MAC address of the NIC)
Eg: ifconfig eth0 HW ether 00: 0C: 29: 03: F3: 76
Several Common commands
1. ifdownDisable Nic
Syntax: ifdown Nic device name
2. IFUPEnable Nic
Syntax: IFUP Nic device name
3.BindIPAndMacAddress
Implementation Method: Create the/etc/ethers file, the file content is "ip address MAC address", and then execute the "ARP-F" command to make the configuration take effect.
For example, bind the IP address 193.168.168.154 to the MAC address 00: 0C: 29: 03: F3: 75.
# Echo "193.168.168.154 00: 0C: 29: 03: F3: 75">/etc/Ethers
# ARP-F
Ethtool --- view NICs and modify Nic configuration tools
Ethtool is a command used to query and SET network interface card parameters.
Usage Overview:
Ethtool ethx // query the Basic settings of the ethx network port. X indicates the ID of the corresponding Nic, such as eth0 and eth1.
Ethtool-H // display the ethtool Command help (HELP)
Ethtool-I ethx // query ethx network port information
Ethtool-D ethx // query the registration information of the ethx network port
Ethtool-r ethx // reset the ethx network port to the Adaptive Mode
Ethtool-s ethx // query the ethx network port receiving and receiving packet statistics
Ethtool-s ethx [speed 10 | 100 | 1000] [duplex half | Full] [autoneg on | off] // sets the network port rate to 10/100/1000 m, and sets the network port half/Full Duplex set whether the network port is self-negotiated
[Root @ Linux/] # ethtool eth1 // view Nic 1 Information
[Root @ Linux/] # ethtool-I eth1 // view Nic model, etc.
[Root @ Linux/] # ethtool-s eth1 // View data rate, etc.
[Root @ Linux/] # ethtool-s eth1 autoneg off speed 100 duplex full // forcibly modify the NIC rate and configure it to a 10-gb Nic. autoneg off is required, if it is on, it is adaptive configuration, which is automatically configured according to machines.
[Root @ Linux/] # Which ethtool// Query the path where ethtool is stored
/Sbin/ethtool
[Root @ Linux/] # rpm-qf/sbin/ethtool// Query the ethtool version.
Ethtool-1.6-5
How to permanently save ethtool settings on a network device
Solution 1:
The ethtool settings can be saved in the/etc/sysconfig/network-scripts/ifcfg-ethx file to activate the options when the device starts next time.
Example: ethtool-s eth0 speed 100 duplex full autoneg off
This command sets the eth0 device to full-duplex adaptive with a speed of MBS. To set these parameters when eth0 is started, modify the file/etc/sysconfig/network-scripts/ifcfg-eth0 and add the following line:
Ethtool_opts = "speed 100 duplex full autoneg off"
Solution 2:
Write ethtool settings to/etc/rc. d/rc. Local.
MII-tool usage
The MII-tool Method for changing the communication negotiation mode of network devices is relatively simple. You can use the-V parameter to view the network interface status. See the following example;
MII-tool changes the network interface negotiation method;
[~] # MiI-tool -- Help
Usage: MII-tool [-vvrrwl] [-a media,... |-F media] [interface...]
-V, -- version display version information
-V, -- verbose more verbose output Note: displays network interface information;
-R, -- reset MII to poweron state Note: reset MII to Enabled state;
-R, -- restart autonegotiation Note: restart the automatic negotiation mode;
-W, -- watch monitor for link status changes Note: view the status changes of network interface connections;
-L, -- log with-W, write events to syslog Note: Write events to system logs;
-A, -- advertise = media,... advertise only specified Media Note: indicates a specific network interface;
-F, -- force = media force specified Media Technology Note: Change the network interface negotiation method;
Media: 100baset4, 100basetx-fd, 100basetx-hd, 10baset-fd, 10baset-hd,
(To advertise both HD and Fd) 100 basetx, 10 BaseT
To change the network interface negotiation method, we need to use the-F option, followed by 100baset4, 100basetx-fd, 100basetx-hd, 10baset-fd, 10baset-hd, and other parameters;
What should we do if we want to change the network interface eth0 to 1000 Mbit/s full duplex mode?
[Root @ localhost ~] # MiI-tool-F 100basetx-fd
[Root @ localhost ~] # MiI-tool-V eth0
IP
The functions of IP and ethtool are similar to those of ifconfig and are more powerful.
Download IP: APT-Get install iproute
# IP ADDR
1: Lo: <loopback, up, 10000> MTU 16436 qdisc noqueue
Link/loopback 00: 00: 00: 00: 00: 00 BRD 00: 00: 00: 00: 00: 00
Inet 127.0.0.1/8 Scope host Lo
Inet6: 1/128 scope host
Valid_lft forever preferred_lft forever
2: eth0: <broadcast, multicast, up, 10000> MTU 1500 qdisc pfifo_fast qlen 1000
Link/ether 00: E0: 22: 02: 25: 46 brd ff: FF
Inet 192.168.1.2/24 BRD 192.168.1.255 scope global eth0
Inet6 fe80: 2e0: 22ff: fe02: 2546/64 scope Link
Valid_lft forever preferred_lft forever
# IP Link
1: Lo: <loopback, up, 10000> MTU 16436 qdisc noqueue
Link/loopback 00: 00: 00: 00: 00: 00 BRD 00: 00: 00: 00: 00: 00
2: eth0: <broadcast, multicast, up, 10000> MTU 1500 qdisc pfifo_fast qlen 1000
Link/ether 00: E0: 22: 02: 25: 46 brd ff: FF
# IP-s link ls Dev eth0
2: eth0: <broadcast, multicast, up, 10000> MTU 1500 qdisc pfifo_fast qlen 1000
Link/ether 00: E0: 22: 02: 25: 46 brd ff: FF
RX: bytes packets errors dropped overrun MCAST
287018517 364010 0 0 0 0
TX: bytes packets errors dropped carrier collsns
272957602 395576 0 0 0 0
Nic Load Testing Tool
If you need to perform detailed load and other metrics detection on the NIC, you can use the following tools:
Tcpdump
Http://www.tcpdump.org/tcpdump_man.html
Tcprelay
Http://tcpreplay.synfin.net/
Http://tcpreplay.synfin.net/wiki/manual
Tcpreplay is a collection of tools used to edit and replay network traffic packages in Unix systems. These traffic packages can be captured by tools such as tcpdump or ethereal. Tcpreplay provides reliable and repeatable methods to test different network devices, including switches, routers, firewalls, intrusion detection systems (IDS), and intrusion prevention systems (IPS ).
Tcpreplay: A common packet sending software that resends packets captured by tcpdump.
Pktgen: the package sending tool that comes with the Linux kernel.
Http://blog.sina.com.cn/s/blog_63ac8a6c0100u17d.html
The detailed address of this document can be found in
Https://skydrive.live.com/embed? Cid = 56b433ad3d1871e3 & resid = 56b433ad3d1871e3% 21611 & authkey = ajbvg12sxg6gscq & EM = 2
Download