When cloning a CentOS 6.5 virtual machine, duplicate network interface configurations can cause conflicts. To avoid this, update the MAC address, hostname, and IP settings to ensure unique identification and connectivity.
1. Update Network Interface Configuration
Edit the primary network interface file to assign a new static IP and correct MAC address:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:50:56:2E:43:6B # Updated MAC from VM settings
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.2.152 # New unique IP to prevent conflict
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
DNS1=192.168.2.150
DNS2=8.8.8.8
2. Clean Persistent Network Rules
Remove or comment out the old network interface rule to prevent udev from reassigning the previous MAC to eth0:
vi /etc/udev/rules.d/70-persistent-net.rules
# Remove or comment out the old entry:
# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:2e:43:6a", ...
# Keep only one active rule with the new MAC:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:2E:43:6B", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
3. Set Hostname and Hosts File
Update the system hostname and local resolution mapping:
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos-node02
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
192.168.2.152 centos-node02
4. Reboot to Apply Changes
init 6
Essential Command-Line Operations
Directory Navigation
cd /var/named/ # Navigate to absolute path
cd .. # Move up one directory level
File Copying with Permissions
cp -p /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
# -p preserves ownership, timestamps, and permissions
Renaming or Moving Files
mv named.localhost zone-backup.db
Vim Editor Shortcuts
i— Enter insert moder— Replace single character:w— Save:w!— Force save:q— Quit:q!— Quit without savingyy— Copy current linep— Paste copied linedd— Delete current line
File and Directory Management
rm filename # Delete file
rm -f filename # Force delete without confirmation
rm -r directory # Recursively delete directory
ls # List files
ls -a # Include hidden files
ls -l # Display detailed permissions
touch newfile.txt # Create empty file
mkdir mydir # Create directory
mkdir -p /a/b/c # Create nested directories
File Permissions and chmod
Linux permissions are represented as three sets of rwx (read, write, execute) for owner, group, and others:
-rwxrwxrwx. 1 root named 152 Jun 21 2007 named.localhost
Permission values:
Apply permissions using numeric notation:
chmod 765 named.localhost
# Results in: rwxrw-r-x
Viewing File Content
cat filename.txt # Display entire file content