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 network card under redhat linux6.5

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

Share

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

This article introduces the relevant knowledge of "how to modify the name of the network card under redhat linux6.5". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

When we install RAC, we need to match the ENI name of the public network and the ENI of the VPC. But when two physical machines have different number of network cards, it is easy to see that one machine has ETH12 and ETH13, but the other machine only has ETH9 and ETH10. So when faced with this problem, how to modify the name of the network card so that the names of the network cards of the two machines can correspond?

In fact, this problem is very similar to the failure to start the network card after cloning the virtual machine. It's just that the newly generated virtual machine after cloning needs to keep the MAC of the network card consistent with the MAC of the 70-persistent-net.rules file. But if you want to change the name of a physical network card, you don't change its MAC address, you just change its name. Let's take a look at how to change the name of the network card.

For example, let's change the local ETH1 to ETH3.

[root@test2 Desktop] # ifconfig-a

Eth2 Link encap:Ethernet HWaddr 00:0C:29:65:02:FF

Inet addr:192.168.199.119 Bcast:192.168.199.255 Mask:255.255.255.0

Inet6 addr: fe80::20c:29ff:fe65:2ff/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

Collisions:0 txqueuelen:1000

RX bytes:112756896 (107.5 MiB) TX bytes:3001189 (2.8MiB)

Lo Link encap:Local Loopback

Inet addr:127.0.0.1 Mask:255.0.0.0

Inet6 addr: 1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

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

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

Collisions:0 txqueuelen:0

RX bytes:5721 (5.5 KiB) TX bytes:5721 (5.5 KiB)

Pan0 Link encap:Ethernet HWaddr 66:13:A7:AD:1E:79

BROADCAST MULTICAST MTU:1500 Metric:1

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

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

Collisions:0 txqueuelen:0

RX bytes:0 (0.0b) TX bytes:0 (0.0b)

[root@test2 Desktop] # ping 192.168.199.118

PING 192.168.199.118 (192.168.199.118) 56 (84) bytes of data.

64 bytes from 192.168.199.118: icmp_seq=1 ttl=64 time=0.787 ms

64 bytes from 192.168.199.118: icmp_seq=2 ttl=64 time=0.880 ms

64 bytes from 192.168.199.118: icmp_seq=3 ttl=64 time=0.758 ms

^ C

-192.168.199.118 ping statistics-

3 packets transmitted, 3 received, 0 packet loss, time 2973ms

Rtt min/avg/max/mdev = 0.758 ms 0.808 ms

Let's take down eth2 first.

[root@test2 Desktop] # ifdown eth2

Then enter the configuration directory

[root@test2 Desktop] # cd / etc/sysconfig/network-scripts

[root@test2 network-scripts] # ls-l ifcfg*

-rw-r--r--. 1 root root 140 Jul 6 05:30 ifcfg-eth2

-rw-r--r--. 1 root root 254 Jan 9 2013 ifcfg-lo

Modify the name of the network card file

[root@test2 network-scripts] # mv ifcfg-eth2 ifcfg-eth4

[root@test2 network-scripts] # ls-l ifcfg*

-rw-r--r--. 1 root root 140 Jul 6 05:30 ifcfg-eth4

-rw-r--r--. 1 root root 254 Jan 9 2013 ifcfg-lo

Edit the new file and change the

Change DEVICE=eth2 to eth4, no need to change the MAC address.

[root@test2 network-scripts] # vi ifcfg-eth4

Then go to the UDEV directory

[root@test2 network-scripts] # cd / etc/udev/rules.d

Find the 70-persistent-net.rules file

[root@test2 rules.d] # ls-l 70*

-rw-r--r--. 1 root root 1342 Feb 17 2014 70-persistent-cd.rules

-rw-r--r--. 1 root root 420 Apr 16 2014 70-persistent-net.rules

[root@test2 rules.d] # vi 70-persistent-net.rules

Modify this file to set the

SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "00:0C:29:65:02:FF", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth2"

Change to

SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "00:0C:29:65:02:FF", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth4"

Save exit.

[root@test2 rules.d] # ifup eth4

Device eth4 does not seem to be present, delaying initialization.

[root@test2 rules.d] # service network restart

Shutting down loopback interface: [OK]

Bringing up loopback interface: [OK]

Bringing up interface eth4: Device eth4 does not seem to be present, delaying initialization.

[FAILED]

It is impossible to start at this time, and you need to restart the machine to make the changes take effect.

[root@test2 rules.d] # reboot

After rebooting, we found that the name had changed.

[root@test2 etc] # ifconfig-a

Eth4 Link encap:Ethernet HWaddr 00:0C:29:65:02:FF

Inet addr:192.168.199.119 Bcast:192.168.199.255 Mask:255.255.255.0

Inet6 addr: fe80::20c:29ff:fe65:2ff/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

Collisions:0 txqueuelen:1000

RX bytes:3162496 (3.0MiB) TX bytes:3905 (3.8KiB)

In another case, the Nic name breakpoint is discontinuous after the physical Nic is added to the machine.

Eth22 Link encap:Ethernet HWaddr 00:90:FA:76:A5:7C

BROADCAST MULTICAST MTU:1500 Metric:1

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

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

Collisions:0 txqueuelen:1000

RX bytes:0 (0.0b) TX bytes:0 (0.0b)

Eth24 Link encap:Ethernet HWaddr 00:90:FA:76:A5:80

Inet addr:11.11.161.65 Bcast:11.11.161.255 Mask:255.255.255.0

Inet6 addr: fe80::290:faff:fe76:a580/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

Collisions:0 txqueuelen:1000

RX bytes:4516473 (4.3 MiB) TX bytes:816 (816.0 b)

Let's take a look at the lack of eth23, at this time, we can delete all the network card configuration, and restart to redistribute the system continuously.

[root@rac2 network-scripts] # cd / etc/udev/rules.d

[root@rac2 rules.d] # ls-l

Total 44

-rw-r--r--. 1 root root 1652 Aug 26 2010 60-fprint-autosuspend.rules

-rw-r--r--. 1 root root 1060 Jun 29 2010 60-pcmcia.rules

-rw-r--r--. 1 root root 316 Aug 6 2013 60-raw.rules

-rw-r--r--. 1 root root 787 Dec 31 19:29 70-persistent-cd.rules

-rw-r--r-- 1 root root 2905 Jan 5 21:47 70-persistent-net.rules

-rw-r--r--. 1 root root 40 Oct 25 2013 80-kvm.rules

-rw-r--r--. 1 root root 320 Sep 12 2012 90-alsa.rules

-rw-r--r--. 1 root root 83 Apr 1 2011 90-hal.rules

-rw-r--r--. 1 root root 2486 Jun 30 2010 97-bluetooth-serial.rules

-rw-r--r--. 1 root root 308 Oct 22 2013 98-kexec.rules

-rw-r--r--. 1 root root 54 Nov 3 2011 99-fuse.rules

[root@rac2 rules.d] # rm-rf 70-persistent-net.rules

[root@rac2 rules.d] # cd / etc/sysconfig/network-scripts

[root@rac2 network-scripts] # ls-l ifcfg*

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth0

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth2

-rw-r--r--. 3 root root 203 Jan 5 00:14 ifcfg-eth20

-rw-r--r--. 3 root root 137 Dec 31 18:52 ifcfg-eth21

-rw-r--r-- 3 root root 202 Jan 5 00:12 ifcfg-eth22

-rw-r--r-- 3 root root 181 Jan 5 00:46 ifcfg-eth24

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth3

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth4

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth5

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth6

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth7

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth7

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth8

-rw-r--r--. 3 root root 136 Dec 31 18:52 ifcfg-eth9

-rw-r--r--. 1 root root 254 Oct 10 2013 ifcfg-lo

[root@rac2 network-scripts] # rm-rf ifcfg-eth*

[root@rac2 network-scripts] # reboot

Everything is fine after reboot.

This is the end of the content of "how to modify the name of the network card under redhat linux6.5". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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