Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the name of the network card by linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Linux how to modify the name of the network card, in view of this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Ifconfig found that the name of the network card (eth2, eth3) does not match the name (eth0, eth2) in the configuration file. Modify it as follows

1. Check the HWADDR corresponding to the name of the network card

[root@linnux] # ifconfig-a

Eth2 Link encap:Ethernet HWaddr 08:00:27:14:87:06

Inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0

Inet6 addr: fe80::a00:27ff:fe14:8706/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:658 errors:0 dropped:0 overruns:0 frame:0

TX packets:527 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:65027 (63.5 KiB) TX bytes:78666 (76.8 KiB)

Eth3 Link encap:Ethernet HWaddr 08:00:27:3E:94:DC

Inet addr:172.168.1.2 Bcast:172.168.1.255 Mask:255.255.255.0

Inet6 addr: fe80::a00:27ff:fe3e:94dc/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:35 errors:0 dropped:0 overruns:0 frame:0

TX packets:37 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:5599 (5.4 KiB) TX bytes:7155 (6.9 KiB)

Edit the ifcfg-eth0 and ifcfg-eth2 files, change the MAC to the correct one, and delete the UUID

[root@node1 ~] # cat / etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet

BOOTPROTO=none

IPADDR=192.168.1.2

PREFIX=24

GATEWAY=192.168.1.1

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME= "eth0"

# UUID=1976d3c7-b6fa-4002-8738-f370de6eddd6

ONBOOT=yes

HWADDR=08:00:27:14:87:06

LAST_CONNECT=1498051708

3. Check the file 70-persistent-net.rules to modify it. The name of the network card should correspond to the MAC address.

[root@node1 ~] # cat / etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the / lib/udev/write_net_rules

# program, run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single

# line, and change only the value of the NAME= key.

# PCI device 0x8086:0x100e (e1000)

# SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "08:00:27:41:05:c4", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth0"

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "08 type 0022", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth0"

# PCI device 0x8086:0x100e (e1000)

SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "08:00:27:3e:94:dc", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth2"

4. Check whether the hostname is correct

[root@node1 ~] # cat / etc/sysconfig/network

NETWORKING=yes

HOSTNAME=node1

The answer to the question about how linux modifies the name of the network card is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report