Configure Static and Dynamic Network Settings on a CentOS 6.7 VM
This guide walks you through setting up both static and dynamic network configurations on a CentOS 6.7 virtual machine in vSphere, covering file edits, firewall handling, service restarts, and verification steps with clear screenshots.
Static Network Configuration
1. Power on the VM and log in with your credentials.
2. Open the network interface file with vi /etc/sysconfig/network-scripts/ifcfg-eth0 (or vim).
3. Edit the file to set ONBOOT=yes and BOOTPROTO=static, then add the required IPADDR, NETMASK, GATEWAY, DNS1, and optionally DNS2.
4. Save the file by pressing Esc and typing :wq!.
5. Verify the changes with cat /etc/sysconfig/network-scripts/ifcfg-eth0.
6. Stop the firewall using service ip6tables stop (a green “ok” indicates success).
7. Restart the network service with service network restart. A green “ok” confirms success; a red “Failed” suggests configuration errors.
8. Check the assigned IP using ifconfig.
9. Test connectivity with ping www.baidu.com. Successful replies indicate the VM can reach the internet.
Dynamic Network Configuration
1. Edit the same interface file: vi /etc/sysconfig/network-scripts/ifcfg-eth0.
2. Set ONBOOT=yes and leave other parameters at their defaults, allowing DHCP to assign IP, gateway, and DNS automatically.
3. Restart the network with service network restart.
4. Verify the obtained IP using ifconfig.
Using DHCP provides a dynamically generated IP, which may be inconvenient for building a Hadoop cluster; therefore, configuring a static IP is often preferred.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Python Crawling & Data Mining
Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
