VMware Virtual machine Cloning CentOS 6.5 Nic Modified Bunker method

Source: Internet
Author: User

VMware Virtual machine Cloning CentOS system, there is a headache is the Mac and network card address need to do the corresponding operation; here's a little bit of a personal idea.
Hope to bring a little joy to everyone's mood.

#!/usr/bin/env bash# file user VMware clones CentOS, modifies NIC, configures IP address, configures Hostsnamehostfile="/etc/sysconfig/network"Netfile="/etc/sysconfig/network-scripts/"FILE70="/etc/udev/rules.d/70-persistent-net.rules"Selinucfile="/etc/selinux/config"Configurebase () {# Modify 70 start file sed-I.'7,12d'${file70} sed-I.'s/eth2/eth0/'${file70} sed-I.'s/eth3/eth1/'${file70} # Fetch MAC address Net701= ' Grep-e"eth0"${FILE70} | Awk-f"==" '{print $}'| Cut-d','-f1 | Sed's/\ "//g'' Net702= ' Grep-e"eth1"${FILE70} | Awk-f"==" '{print $}'| Cut-d','-f1 | Sed's/\ "//g'' # Modify the NIC NetF1= ' grep'HWADDR'${netfile}ifcfg-eth0 | Awk-f'=' '{print $}'' NetF2= ' grep'HWADDR'${netfile}ifcfg-eth1 | Awk-f'=' '{print $}'' Read-P"Enter Configure ip>>"Inpip Sleep3sed-I. s/"HWADDR=${NETF1}"/"hwaddr=${net701}"/${netfile}ifcfg-eth0 sed-I. s/"ipaddr=10.10.100.2[0-9]\{1,\}"/"Ipaddr=10.10.100.${inpip}"/${netfile}ifcfg-eth0 sed-I. s/"HWADDR=${NETF2}"/"hwaddr=${net702}"/${netfile}ifcfg-eth1 # Modify config file, restart effective (permanent) Read-P"Enter your hostname>>"HN Currhn=' hostname ' sed-I. s/"Hostname=${currhn}"/"Hostname=${hn}"/${hostfile} # Direct Config # hostname ${hn}} Disabsomser () {Service iptables stop/sbin/chkconfig iptables off sed-I.'s/selinux=enforcing/selinux=disabled/'${selinucfile}} RUN () {configurebase disabsomser reboot}run

VMware Virtual machine Cloning CentOS 6.5 Nic Modified Bunker method

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.