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 reconfigure the network card when replicating VM and VBOX virtual machines

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to reconfigure the network card when replicating VM and VBOX virtual machines? This problem may be often seen in our daily study or work. Through this question, I hope you can gain more. Let's take a look at the solution with the editor today.

1. For newly replicated virtual machines, please choose to regenerate the MAC address. When copying (cloning, WHATEVER), or after the replication is completed, or after the completion of the configuration, Nic attributes, advanced attributes (different platforms, find the regenerated MAC address, check it, or refresh it). Write down the MAC address

2. After the new virtual machine starts, stop NetworkManager.Service... regardless of whether the network is normal or not. It really doesn't work that well.

Systemctl stop NetworkManager

Systemctl disable NetworkManager

3. Run ifconfig-a to get the Nic name of the new Nic (also the device name, which is easy to match with the MAC address just recorded)

4. Go to the / etc/sysconfig/network-scripts folder to modify the ifcfg-enxxx Nic startup configuration file.

It is strongly recommended to delete ifcfg-profile1 similar to this script, which is a NetManager legacy.

Get the uuid write configuration file in a format like uuidgen enxxx.

4.3.Reboot the network card device systemctl restart network after writing the configuration file. It would have been done if it had not been reported wrong.

# example:

# configuring a network card ultimately requires three elements, device name, MAC address, and UUID

Eno16777736: flags=4163 mtu 1500 inet 192.168.1.201 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:fe4a:b12c prefixlen 64 scopeid 0x20 ether 00:0c:29:4a:b1:2c txqueuelen 1000 (Ethernet) RX packets 3647 bytes 3417904 (3.2MiB) RX errors 0 dropped 0 frame 0 TX packets 140 bytes 18249 (17.8 KiB) TX errors 0 Dropped 0 overruns 0 carrier 0 collisions 0eno33554992: flags=4163 mtu 1500 inet 192.168.199.241 netmask 255.255.255.0 broadcast 192.168.199.255 inet6 fe80::20c:29ff:fe4a:b136 prefixlen 64 scopeid 0x20 ether 00:0c:29:4a:b1:36 txqueuelen 1000 (Ethernet) RX packets 5605 bytes 3465915 (3.3MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1400 bytes 322360 (314.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

# uuidgen (note that each generation of UUID is different, but each generated ID is available)

[root@mysql01 dev] # uuidgen eno16777736fd32246b-c655-45c6-ab6a-7a6aa84faa72 [root@mysql01 network-scripts] # uuidgen eno3355499244e70d2f-4bf1-4753-865b-8fb042ecc8d6 device name MAC address UUIDeno1677773600:0c:29:4a:b1:2cfd32246b-c655-45c6-ab6a-7a6aa84faa72eno3355499200:0c:29:4a:b1:3644e70d2f-4bf1-4753-865b-8fb042ecc8d6

# stop NetworkManager

[root@mysql01 network-scripts] # systemctl stop NetworkManager [root@mysql01 network-scripts] # systemctl disable NetworkManagerRemoved symlink / etc/systemd/system/multi-user.target.wants/NetworkManager.service.Removed symlink / etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.Removed symlink / etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service. [root@mysql01 network-scripts] # systemctl status NetworkManager* NetworkManager.service-NetworkManager Loaded: loaded (/ usr/lib/systemd/system/NetworkManager.service; disabled Vendor preset: enabled) Active: inactive (dead) since 2020-01-26 14:22:15 CST 36s ago Main PID: 8417 (code=exited, status=0/SUCCESS) January 26 14:22:07 mysql01 NetworkManager [8417]: (eno16777736): Activation: successful, device activated.1 month 26 14:22:07 mysql01 NetworkManager [8417]: wpa_supplicant running1 month 26 14:22:07 mysql01 NetworkManager [8417]: (virbr0): device state change: secondaries-> activated (reason 'none...100 0) January 26 14:22:07 mysql01 NetworkManager [8417]: (virbr0): Activation: successful Device activated.1 26 14:22:15 mysql01 NetworkManager [8417]: caught SIGTERM Shutting down normally.1 month 26 14:22:15 mysql01 NetworkManager [8417]: (virbr0): bridge port virbr0-nic was detached1 month 26 14:22:15 mysql01 NetworkManager [8417]: (virbr0-nic): released from master virbr01 month 26 14:22:15 mysql01 systemd [1]: Stopping Network Manager...1 month 26 14:22:15 mysql01 NetworkManager [8417]: exiting (success) January 26 14:22:15 mysql01 systemd [1]: Stopped Network Manager.Hint: Some lines were ellipsized Use-l to show in full. [root@mysql01 network-scripts] # ifconfig

# write configuration file: (the UUID here may be different from the one I got above, because the configuration file was written before.)

-rw-r--r--. 1 root root 292 January 24 14:52 ifcfg-eno16777736

-rw-r--r--. 1 root root 367 January 26 13:29 ifcfg-eno33554992

[root@mysql01 network-scripts] # cat ifcfg-eno16777736TYPE=EthernetBOOTPROTO=noneDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noNAME=eno16777736UUID=a808b074-580flun 4ff7Mub70aMUE307769e8d96 DEVICEMAXeno16777736ONBOOTOEYEIPADDRYE192.168.1.201PREFIX24IPV6 PEERDNSIPV6IPV6 PEERROUTES = ys [root @ mysql01 network-scripts] # cat ifcfg-eno33554992TYPE=EthernetBOOTPROTO=staticIPADDR0=192.168.199.241PREFIXO0=24GATEWAY=192.168.199.1DNS1=192.168.199.1DEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noNAME=eno33554992UUID=9c7d8550-2d46-45c1-9c40-ef09570e1608DEVICE=eno33554992ONBOOT=yesPEERDNS=yesPEERROUTES=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yes

# restart network service:

[root@mysql01 network-scripts] # systemctl restart network.service [root@mysql01 network-scripts] #

# No error report

[root@mysql01 network-scripts] # systemctl status network.service* network.service-LSB: Bring up/down networking Loaded: loaded (/ etc/rc.d/init.d/network) Active: active (exited) since Day 2020-01-26 14:27:22 CST 18s ago Docs: man:systemd-sysv-generator (8) Process: 8612 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 8839 ExecStart=/etc/rc.d/init.d/network start (code=exited Status=0/SUCCESS) January 26 14:27:17 mysql01 systemd [1]: Starting LSB: Bring up/down networking...1 26 14:27:17 mysql01 network [8839]: [29B blob data] January 26 14:27:19 mysql01 network [8839]: [37B blob data] January 26 14:27:22 mysql01 network [8839]: [37B blob data] January 26 14:27:22 mysql01 systemd [1]: Started LSB: Bring up/down networking. [root@mysql01 network-scripts] #

# try ifup/ifdown script:

[root@mysql01 network-scripts] # ifdown eno16777736 [root@mysql01 network-scripts] # ifconfig eno16777736eno16777736: flags=4098 mtu 1500 ether 00:0c:29:4a:b1:2c txqueuelen 1000 (Ethernet) RX packets 4359 bytes 4215191 (4.0MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 169 bytes 22144 (21.6KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@mysql01 network-scripts] # ifup eno16777736 [root@mysql01 network -scripts] # ifconfig eno16777736eno16777736: flags=4163 mtu 1500 inet 192.168.1.201 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:fe4a:b12c prefixlen 64 scopeid 0x20 ether 00:0c:29:4a:b1:2c txqueuelen 1000 (Ethernet) RX packets 4362 bytes 4218484 (4.0 MiB) RX errors 0 dropped 0 overruns 0 TX packets 187 bytes 25011 (24.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@mysql01 network-scripts] # [root@mysql01 network-scripts] # ifdown eno33554992 [root@mysql01 Desktop] # ifconfig eno33554992eno33554992: flags=4098 mtu 1500 ether 00:0c:29:4a:b1:36 txqueuelen 1000 (Ethernet) RX packets 7980 bytes 4516864 (4.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2422 bytes 504771 (492.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@mysql01 Desktop] # ifup eno33554992 [root@mysql01 Desktop] # ifconfig eno33554992eno33554992: flags=4163 mtu 1500 inet 192.168.199.241 netmask 255.255.255.0 broadcast 192.168.199.255 inet6 fe80::20c:29ff:fe4a:b136 prefixlen 64 scopeid 0x20 ether 00:0c:29:4a:b1:36 txqueuelen 1000 (Ethernet) RX packets 7982 bytes 4519567 (4.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2440 bytes 507648 (495.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@mysql01 Desktop] #

After reading this article, have you learned to reconfigure the network card when replicating VM and VBOX virtual machines? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

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