How to set a Static IP address in CentOs7 Minimal Server.
How to set a Static IP address in CentOs7 Minimal Server:
For certain type of servers , it is mandatory to assign a static IP address especially if they are serving the internet or if they are running any mission critical business applications. Ex: web server , Application server , DNS , DHCP , FTP , etc..
Prerequisites: CentOs7 Minimal Server.
To Set Static IP address in a CentOs 7 server, follow,
- Login as root or an account with root privileges.
- From the command line type,
vi /etc/sysconfig/network-scripts/ifcfg-ens33
(ens33 is the network adapter of my OS, this may vary . To check your installed network adapter use IP addr or IP Link or route -n – Try the Output yourself). - Delete the config in the file and input the below lines ,
TYPE="Ethernet" BOOTPROTO="static" IPADDR=192.168.55.170 NETMASK=255.255.255.0 GATEWAY=192.168.55.2 DEFROUTE="yes" PEERDNS="yes" PEERROUTES="yes" NAME="ens33" UUID="9de06be5-a36b-4937-9c11-b64f829eeac4" DEVICE="ens33" ONBOOT="yes" ZONE=public
Note: Enter your preferred IP address , Netmask and Gateway.
- Save the config file and restart the network service using the command ,
systemctl restart network
This will set Static IP address for your CentOs7 machine.
Keywords:
CentOs 7, Static Ip , IP address, Servers, DHCP , Netmask , Gateway, DNS , Routing , Network , Networking , Networks , Linux/GNU , BootProto , Onboot, VI , Configuration ,IP addr , IP Link , Route -n, systemctl , route , Protocol .