In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you Linux how to modify the name of the network card, host name, I believe that most people do not know much, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Linux modifies the Nic name and hostname
Environment: VirtualBox 5.0.14 + RHEL 6.5
Requirements: when building a set of Standby RAC in a personal experiment, in order to save time, directly copy the host template where RAC was installed before.
However, after replication, it is found that the name of the Nic is inconsistent:
In my environment, the name of the network card corresponding to Public IP and Private IP of Primary RAC is eth3,eth4.
One of the network cards that copy Standby RAC is named eth7,eth7; and the other is eth5,eth6. In order to maintain consistency and facilitate subsequent management and maintenance, it is necessary to change the network cards of both Standby RAC machines to eth3,eth4.
Similarly, the copied hostname is the same as before, so change the hostname as well.
Take one of them as an example: first, check the current network situation of the host, as shown below:
Confirm that the MAC address of eth7 is: 08:00:27:62:CC:7B
Confirm that the MAC address of eth7 is: 08:00:27:BC:1B:9F
And then in the settings of VirtualBox
Confirm that eth7 corresponds to the internal network (Private IP) based on the MAC address, while eth7 corresponds to the public network (Public IP).
So the right thing to do is to change the name of eth7 to eth4 and the name of eth7 to eth3.
Note: some students may directly take it for granted that the MAC address has been modified incorrectly, but it must be confirmed here. For DBA, the details of anything you do are very important.
1. First modify the / etc/udev/rules.d/70-persistent-net.rules file:
Delete all irrelevant Nic information (if you are afraid of misoperation, you can not delete it. It is recommended to delete it. It is clear and easy to manage)
Then change the name of eth7 to eth4 and the name of eth7 to eth3. The final modification is as follows:
[root@jyrac1 ~] # 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:bc:1b:9f" ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth4" # PCI device 0x8086:0x100e (e1000) SUBSYSTEM== "net", ACTION== "add", DRIVERS== "? *", ATTR {address} = = "08:00:27:62:cc:7b", ATTR {type} = = "1", KERNEL== "eth*", NAME= "eth3"
two。 Confirm the network ifcfg-ethN configuration file and modify the information:
[root@jyrac1 network-scripts] # cat ifcfg-eth3DEVICE=eth3TYPE=EthernetONBOOT=yesBOOTPROTO=staticIPADDR=192.168.1.61NETMASK=255.255.255.0 [root@jyrac1 network-scripts] # cat ifcfg-eth4DEVICE=eth4TYPE=EthernetONBOOT=yesBOOTPROTO=staticIPADDR=10.10.10.61NETMASK=255.255.255.0
3.reboot restarts the host, and the network name is modified successfully and starts normally, as follows:
[root@jyrac1 ~] # ifconfig-aeth3 Link encap:Ethernet HWaddr 08:00:27:62:CC:7B inet addr:192.168.1.61 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe62:cc7b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:377 errors:0 dropped:0 overruns:0 frame:0 TX packets:51 errors:0 dropped:0 overruns : 0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:28101 (27.4 KiB) TX bytes:6495 (6.3 KiB) eth4 Link encap:Ethernet HWaddr 08:00:27:BC:1B:9F inet addr:10.10.10.61 Bcast:10.10.10.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:febc:1b9f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets: 511 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:46118 (45.0 KiB) TX bytes:816 (816.0 b) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: 1thumb 128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:4 Errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:340 (340.0 b) TX bytes:340 (340.0 b)
In this way, you can connect to the host computer through SecureCRT for easy operation.
The next step is to change the host name and / etc/hosts:
Hostname modification:
Hostname jystdrac1 (temporary)
[root@jyrac1 network-scripts] # hostname jystdrac1
Vi / etc/sysconfig/network (restart takes effect)
[root@jyrac1 network-scripts] # vi / etc/sysconfig/networkNETWORKING=yesHOSTNAME=jystdrac1
Vi / etc/hosts (as planned by Standby RAC)
# public ip192.168.1.61 jystdrac1192.168.1.63 jystdrac2#virtual ip192.168.1.62 jystdrac1-vip192.168.1.64 jystdrac2-vip#scan ip192.168.1.65 jystdrac-scan#private ip10.10.10.61 jystdrac1-priv10.10.10.63 jystdrac2-priv
Log in to SHELL again to see the correct hostname configuration:
Last login: Wed Aug 2 20:37:13 2017 from 192.168.1.88 [root@jystdrac1] # [root@jystdrac1] # hostname-i192.168.1.61 [root@jystdrac1 ~] #
At this point, the work of modifying the network card name and host name of this node has been completed, and the other node can be modified in the same way.
The above is all the contents of the article "how to modify the network card name and host name of Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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: 229
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.