https://www.cyberciti.biz/media/new/category/old/centos_logo.png

I am a new sysadmin and CentOS user. My system is configured to use DHCP. How can I switch from DHCP to static IP address on CentOS 7 desktop system? How do I setup a static TCP/IP address on my CentOS Linux 7 or Red Hat Enterprise Linux 7 server using command line option?

On CentOS 7 or RHEL 7 one need to use the NetworkManager daemon. It attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices. In this quick tutorial you will learn about configuring a network interface with a static IP address using ifcfg files located in /etc/sysconfig/network-scripts/ directory in a CentOS 7 and RHEL 7:

Advertisement

  1. Create a file named /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:
  2. DEVICE=eth0
  3. BOOTPROTO=none
  4. ONBOOT=yes
  5. PREFIX=24
  6. IPADDR=192.168.2.203
  7. Restart network service: systemctl restart network

Tutorial details


Difficulty level


Root privileges


Requirements


Category