A summary of network card problems under Linux

Source: Internet
Author: User

Q: After backup in the recovery system, the NIC number becomes eth1 instead of eth0

A: Modify the Udev rules file, delete the 70-persistent-net.rules file under the/ETC/UDEV/RULE.D directory, and then restart

For some special applications, such as a USB stick Linux system, after deleting the file, you can create a folder with the same name in the directory mkdir 70-persistent-net.rules so that no Udev rule file will be generated after each boot.

Q: Set multiple IP addresses for a single NIC

A: You need to create a new two configuration file under/etc/sysconfig/network-scripts

ifcfg-eth0:0 content is as follows:

device=eth0:0

Bootproto=static

ipaddr=192.168.168.2

netmask=255.255.255.0

Onboot=yes

ifcfg-eth0:1 content is as follows:

Device=eth0:1

Bootproto=static

ipaddr=192.168.168.3

netmask=255.255.255.0

Onboot=yes

Q: Manually Change the network number

A: For some single-card motherboard, if due to the need to plug in a PCIe network card. Because Udev assigns the network number according to the PCIe root port, the onboard network card is assigned as eth0 and the external PCIe NIC is assigned to ETH1.

The onboard network card is eth1 if the external plug-in PCIe adapter is eth0 due to need to be specified. This can be done by writing a script to modify the network card number, and then adding the statement that executes the script in/etc/init.d/rc.local.

The script can be written as: (This example does a binding motherboard operation)

#!/bin/bash

#默认UUID

uuid1= "################################"

# Querying the motherboard UUID

Uuid2= ' (dmidecode-t 1|grep-i uuid|sed ' s/^.*://g ' |sed ' s/-//g ') '

If ["$uuid 1" = "$uuid 2"]; then

IP link set eth0 name eth2

IP link Set eth1 name eth0

IP link Set eth2 name eth1
Fi
# Make a network label replacement

Ifconfig eth0 192.168.1.102
Ifconfig eth1 192.168.10.100

A summary of network card problems under Linux

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.