{"id":2089,"date":"2017-09-25T12:15:34","date_gmt":"2017-09-25T06:45:34","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2089"},"modified":"2026-09-09T17:38:22","modified_gmt":"2026-09-09T12:08:22","slug":"set-static-ip-address-centos7-minimal-server","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/set-static-ip-address-centos7-minimal-server\/","title":{"rendered":"How to Configure a Static IP Address on CentOS7"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A static IP address is important for servers that need a consistent and reliable network address. Unlike a DHCP-assigned IP address, a static IP does not change automatically, making it suitable for servers hosting websites, applications, DNS, DHCP, FTP, and other mission-critical services.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we will explain how to configure a static IP address on a CentOS 7 Minimal Server using the network interface configuration file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before configuring a static IP address, ensure that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You have a CentOS 7 Minimal Server.<\/li>\n\n\n\n<li>You have root access or an account with sudo privileges.<\/li>\n\n\n\n<li>You know the required <strong>IP address<\/strong>, <strong>Subnet Mask<\/strong>, and <strong>Gateway<\/strong>.<\/li>\n\n\n\n<li>You know the name of the network interface.<\/li>\n\n\n\n<li>You have access to the server&#8217;s command line.<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n<h2>Implementation<\/h2>\n<p>To set a static IP address on a CentOS 7 server, follow,<\/p>\n<ol>\n<li>Log in as root or an account with root privileges.<\/li>\n<li>From the command line, type, <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vi \/etc\/sysconfig\/network-scripts\/ifcfg-ens33<\/code>\u00a0 \u00a0(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).<\/li>\n<li>Delete the config in the file and input the lines below,\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">TYPE=\"Ethernet\"\nBOOTPROTO=\"static\"\nIPADDR=192.168.55.170\nNETMASK=255.255.255.0\nGATEWAY=192.168.55.2\nDEFROUTE=\"yes\"\nPEERDNS=\"yes\"\nPEERROUTES=\"yes\"\nNAME=\"ens33\"\nUUID=\"9de06be5-a36b-4937-9c11-b64f829eeac4\"\nDEVICE=\"ens33\"\nONBOOT=\"yes\"\nZONE=public<\/pre>\n<p>Note: Enter your preferred IP address, netmask, and Gateway.<\/p>\n<\/li>\n<li>Save the config file and restart the network service using the command, <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">systemctl restart network<\/code> This will set a static IP address for your CentOs7 machine.<\/li>\n<\/ol>\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring a static IP address on a CentOS 7 server ensures that the server remains accessible through a consistent network address. This is especially important for web, application, DNS, DHCP, FTP, and other production servers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By updating the network interface configuration and restarting the network service, you can successfully assign a static IP address to the CentOS 7 server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. How can I find the network interface name in CentOS 7?<\/strong><br>Use the <code>ip addr<\/code> or <code>ip link<\/code> command to identify the network interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. How can I verify that the static IP is configured successfully?<\/strong><br>After restarting the network service, use <code>ip addr<\/code> to verify the assigned IP address and <code>ping<\/code> to test network connectivity.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. What happens if I configure the wrong IP address, subnet mask, or gateway?<\/strong><br>The server may lose network connectivity. Always verify these network details before restarting the network service.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/find-default-gateway-centos7-minimal-server\/\">How to find default gateway in CentOs7 Minimal Server<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team\u00a0<a href=\"https:\/\/pheonixsolutions.com\/contact\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction A static IP address is important for servers that need a consistent and reliable network address. Unlike a DHCP-assigned [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-2089","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-xH","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2089"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2089\/revisions"}],"predecessor-version":[{"id":11587,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2089\/revisions\/11587"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}