Operations 5 min read

How to Configure Static and Dynamic Network Settings on CentOS 6.7 in vSphere

This guide walks you through setting up both static and dynamic network configurations on a CentOS 6.7 virtual machine running in vSphere, covering file edits, firewall handling, service restarts, and verification steps with screenshots.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
How to Configure Static and Dynamic Network Settings on CentOS 6.7 in vSphere

Earlier we shared how to install CentOS 6.7 on a VM via vSphere Client. The VM is now ready; this article explains how to configure its network.

Static Network Configuration

1. Power on the VM and log in with your credentials.

Login screen
Login screen

2. Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 using vi or vim. The file initially contains only device information.

ifcfg-eth0 file
ifcfg-eth0 file

3. Change ONBOOT to yes and BOOTPROTO to static, then add the desired IP address, gateway, netmask, DNS1 and DNS2.

Network settings
Network settings

4. Save the file by pressing Esc and typing :wq!.

5. Verify the changes with cat /etc/sysconfig/network-scripts/ifcfg-eth0.

6. Disable the firewall: service ip6tables stop.

Firewall stopped
Firewall stopped

7. Restart the network service: service network restart. A green “ok” indicates success; a red “Failed” suggests configuration errors such as an unavailable IP or missing ONBOOT/BOOTPROTO settings.

Network restart result
Network restart result

8. Check the assigned IP with ifconfig and test connectivity by pinging www.baidu.com. Use Ctrl+C to stop the ping.

ifconfig output
ifconfig output
Ping test result
Ping test result

Dynamic Network Configuration

1. Open /etc/sysconfig/network-scripts/ifcfg-eth0 in an editor.

Dynamic configuration file
Dynamic configuration file

2. Set ONBOOT = yes and leave other parameters at their defaults; the system will obtain IP, gateway, etc., via DHCP.

3. Restart the network service: service network restart.

4. Verify the IP address with ifconfig.

Dynamic IP output
Dynamic IP output

Note: DHCP assigns a dynamic IP, which is inconvenient for building a Hadoop cluster, so static IP configuration is preferred.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxCentOSvSphereStatic IPDynamic IP
Python Crawling & Data Mining
Written by

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!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.