{"id":11682,"date":"2025-06-19T08:57:01","date_gmt":"2025-06-19T08:57:01","guid":{"rendered":"https:\/\/mainvps.net\/blog\/?p=11682"},"modified":"2026-03-30T09:17:07","modified_gmt":"2026-03-30T09:17:07","slug":"configure-networking-centos-7-8-guide","status":"publish","type":"post","link":"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/","title":{"rendered":"How to Configure Networking on CentOS (7 &amp; 8): An Expert\u2019s Guide"},"content":{"rendered":"\n<p>A dedicated IP is literally an IP address that is only assigned to you, whereas a VPS, or Virtual Private Server, is a complete server with its own operating system, offering you full control over your hosting environment. When comparing <strong>dedicated IP vs VPS<\/strong>, it\u2019s important to understand that they serve different purposes but work best together in professional hosting setups.<\/p>\n\n\n\n<p>In real-world scenarios, especially when you <strong>configure networking on CentOS,<\/strong> both a VPS and a dedicated IP play a crucial role. A VPS provides the server environment where you manage network settings, applications, and security, while a dedicated IP ensures a unique identity for your server, improving reliability, email reputation, and secure access configurations.<\/p>\n\n\n\n<p>Going a step further, having a dedicated IP also offers you the advantage of having your online presence exclusively linked to your own IP address, which is crucial when dealing with email services, websites, and other secure settings, such as <a href=\"https:\/\/mainvps.net\/blog\/free-ssl-vs-paid-ssl-guide\/\" data-type=\"post\" data-id=\"3231\">SSL<\/a>, without having to rely on a shared environment. As far as the dedicated IP vs VPS debate is concerned, having an IP ensures your unique identity and reputation, whereas having a VPS ensures that you have the best infrastructure and performance to run your applications in the most efficient way possible.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Deep_Dive_How_Networking_Works_in_CentOS\" >Deep Dive: How Networking Works in CentOS<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Core_Networking_Layers\" >Core Networking Layers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#How_Data_Flows_in_CentOS_Networking\" >How Data Flows in CentOS Networking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#CentOS_7_vs_CentOS_8_Networking_Approach\" >CentOS 7 vs CentOS 8 Networking Approach<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Role_of_Network_Services\" >Role of Network Services<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Virtualization_and_Networking\" >Virtualization and Networking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Why_This_Architecture_Matters\" >Why This Architecture Matters<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Understanding_Network_Interface_Naming\" >Understanding Network Interface Naming<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Static_vs_Dynamic_IP_When_to_Use_What\" >Static vs Dynamic IP: When to Use What<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Static_IP_Recommended_for_Servers\" >Static IP (Recommended for Servers)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Dynamic_IP_DHCP\" >Dynamic IP (DHCP)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Advanced_Static_IP_Configuration_Persistent\" >Advanced Static IP Configuration (Persistent)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Network_Bonding_for_High_Availability\" >Network Bonding for High Availability<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Benefits\" >Benefits:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Bridged_Networking_For_Virtualization\" >Bridged Networking (For Virtualization)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Use_Case\" >Use Case:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Advanced_DNS_Configuration\" >Advanced DNS Configuration<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Best_DNS_Providers\" >Best DNS Providers:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Routing_Configuration_Advanced\" >Routing Configuration (Advanced)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Firewall_and_Network_Security\" >Firewall and Network Security<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Open_Ports\" >Open Ports:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Block_IP_Address\" >Block IP Address:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#SELinux_and_Networking\" >SELinux and Networking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Performance_Optimization_Tips\" >Performance Optimization Tips<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Pro_Tips_for_Real-World_Usage\" >Pro Tips for Real-World Usage<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Troubleshooting_Table\" >Troubleshooting Table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Final_Thoughts\" >Final Thoughts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#FAQs\" >FAQs<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/#Suggestions\" >Suggestions:<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Deep_Dive_How_Networking_Works_in_CentOS\"><\/span><strong>Deep Dive: How Networking Works in CentOS<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>CentOS relies on a layered networking architecture that ensures efficient communication between hardware, the operating system, and external networks. Understanding these layers helps you diagnose issues faster and build a more stable server environment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Core_Networking_Layers\"><\/span><strong>Core Networking Layers<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Kernel Level:<\/strong><br>The <a href=\"https:\/\/mainvps.net\/blog\/buy-linux-vps-hosting\/\" data-type=\"post\" data-id=\"12400\">Linux <\/a>kernel is responsible for low-level networking operations such as packet routing, traffic handling, and communication with network drivers. It processes incoming and outgoing packets using protocols like TCP\/IP and ensures data reaches the correct destination.<\/li>\n\n\n\n<li><strong>Network Interfaces:<\/strong><br>These are the actual connection points, either physical (NICs) or virtual interfaces. Virtual interfaces are commonly used in VPS, containers, and cloud environments, allowing multiple isolated networks on a single physical machine.<\/li>\n\n\n\n<li><strong>NetworkManager:<\/strong><br>A powerful service that simplifies network configuration and management. It dynamically handles connections, detects network changes, and allows administrators to configure settings using tools like <code>nmcli<\/code> the command line and text UI.<\/li>\n\n\n\n<li><strong>Configuration Files:<\/strong><br>Persistent settings are stored in system files, ensuring configurations remain intact after reboots. In CentOS 7, these are typically found in <code>\/etc\/sysconfig\/network-scripts\/<\/code>CentOS 8 relies more on NetworkManager-managed profiles.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_Data_Flows_in_CentOS_Networking\"><\/span><strong>How Data Flows in CentOS Networking<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>When a request is made (for example, accessing a website):<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The application sends a request to the network stack<\/li>\n\n\n\n<li>The kernel processes the packet and determines the routing<\/li>\n\n\n\n<li>The packet is sent through the appropriate network interface<\/li>\n\n\n\n<li>DNS resolves the domain to an IP address<\/li>\n\n\n\n<li>The remote server responds, and the process reverses<\/li>\n<\/ol>\n\n\n\n<p>This entire flow happens in milliseconds, making efficient configuration crucial for performance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"CentOS_7_vs_CentOS_8_Networking_Approach\"><\/span><strong>CentOS 7 vs CentOS 8 Networking Approach<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CentOS 7:<\/strong><br>Supports both traditional network scripts and NetworkManager. Administrators can manually edit configuration files, offering more control but requiring deeper technical knowledge.<\/li>\n\n\n\n<li><strong>CentOS 8:<\/strong><br>Fully adopts NetworkManager as the default tool, providing a more modern, flexible, and automation-friendly approach. It reduces manual configuration errors and improves consistency across environments.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Role_of_Network_Services\"><\/span><strong>Role of Network Services<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/en.wikipedia.org\/wiki\/Dynamic_Host_Configuration_Protocol\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">DHCP (Dynamic Host Configuration Protocol)<\/a>:<\/strong> Automatically assigns IP addresses<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/en.wikipedia.org\/wiki\/Domain_Name_System\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">DNS (Domain Name System)<\/a>:<\/strong> Translates domain names into IP addresses<\/li>\n\n\n\n<li><strong>Gateway:<\/strong> Acts as the bridge between local and external networks<\/li>\n\n\n\n<li><strong>Firewall (firewalld):<\/strong> Controls incoming and outgoing traffic<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Virtualization_and_Networking\"><\/span><strong>Virtualization and Networking<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In VPS and cloud environments, networking becomes more abstract:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Virtual NICs are assigned to each VPS<\/li>\n\n\n\n<li>Bridges connect virtual machines to physical networks<\/li>\n\n\n\n<li>NAT (Network Address Translation) allows multiple systems to share public IPs<\/li>\n<\/ul>\n\n\n\n<p>This is why understanding networking in CentOS is especially important for hosting environments.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_This_Architecture_Matters\"><\/span><strong>Why This Architecture Matters<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>A clear understanding of<a href=\"https:\/\/mainvps.net\/blog\/yum-reinstall-repo-management-centos\/\" data-type=\"post\" data-id=\"11489\"> CentOS <\/a>networking architecture allows you to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Troubleshoot connectivity issues quickly<\/li>\n\n\n\n<li>Optimize server performance<\/li>\n\n\n\n<li>Secure your infrastructure effectively<\/li>\n\n\n\n<li>Scale your network for growing applications<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Understanding_Network_Interface_Naming\"><\/span><strong>Understanding Network Interface Naming<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Modern Linux systems use <strong>predictable network interface names<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>ens33<\/code> \u2192 Ethernet interface<\/li>\n\n\n\n<li><code>enp0s3<\/code> \u2192 PCI-based interface<\/li>\n\n\n\n<li><code>eth0<\/code> \u2192 Legacy naming<\/li>\n<\/ul>\n\n\n\n<p>Check details:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip link show<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Static_vs_Dynamic_IP_When_to_Use_What\"><\/span><strong>Static vs Dynamic IP: When to Use What<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Static_IP_Recommended_for_Servers\"><\/span><strong>Static IP (Recommended for Servers)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Required for hosting websites and applications<\/li>\n\n\n\n<li>Needed for DNS mapping<\/li>\n\n\n\n<li>Ensures consistent access<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Dynamic_IP_DHCP\"><\/span><strong>Dynamic IP (DHCP)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ideal for testing environments<\/li>\n\n\n\n<li>Used in temporary setups<\/li>\n\n\n\n<li>Automatically assigned<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Advanced_Static_IP_Configuration_Persistent\"><\/span><strong>Advanced Static IP Configuration (Persistent)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In production environments, always verify persistence after reboot:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nmcli connection reload<br>nmcli connection show<\/pre>\n\n\n\n<p>Also, disable DHCP fallback:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nmcli con mod eth0 ipv4.never-default yes<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Network_Bonding_for_High_Availability\"><\/span><strong>Network Bonding for High Availability<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Bonding combines multiple interfaces into one logical interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Benefits\"><\/span>Benefits:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fault tolerance<\/li>\n\n\n\n<li>Increased throughput<\/li>\n\n\n\n<li>Load balancing<\/li>\n<\/ul>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nmcli con add type bond ifname bond0 mode balance-rr<br>nmcli con add type ethernet ifname eth0 master bond0<br>nmcli con add type ethernet ifname eth1 master bond0<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Bridged_Networking_For_Virtualization\"><\/span><strong>Bridged Networking (For Virtualization)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Used when running virtual machines (<a href=\"https:\/\/mainvps.net\/kvm-vps\" target=\"_blank\" rel=\"noreferrer noopener\">KVM<\/a>, VMware, etc.).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nmcli con add type bridge ifname br0<br>nmcli con add type ethernet ifname eth0 master br0<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Use_Case\"><\/span>Use Case:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>VPS hosting environments<\/li>\n\n\n\n<li>Container networking<\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/traditional-vs-cloud-hosting\/\" data-type=\"post\" data-id=\"10462\">Cloud<\/a> infrastructure<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Advanced_DNS_Configuration\"><\/span><strong>Advanced DNS Configuration<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Instead of editing <code>\/etc\/resolv.conf<\/code> manually, configure DNS permanently:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nmcli con mod eth0 ipv4.dns \"1.1.1.1 8.8.8.8\"<br>nmcli con mod eth0 ipv4.ignore-auto-dns yes<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Best_DNS_Providers\"><\/span>Best DNS Providers:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Google DNS: <code>8.8.8.8<\/code><\/li>\n\n\n\n<li>Cloudflare DNS: <code>1.1.1.1<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Routing_Configuration_Advanced\"><\/span><strong>Routing Configuration (Advanced)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To add a static route:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nmcli con mod eth0 +ipv4.routes \"192.168.2.0\/24 192.168.1.1\"<\/pre>\n\n\n\n<p>View routes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ip route show<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Firewall_and_Network_Security\"><\/span><strong>Firewall and Network Security<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>CentOS uses <code>firewalld<\/code> for managing rules.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Open_Ports\"><\/span>Open Ports:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">firewall-cmd --add-port=8080\/tcp --permanent<br>firewall-cmd --reload<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Block_IP_Address\"><\/span>Block IP Address:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">firewall-cmd --add-rich-rule='rule family=\"ipv4\" source address=\"192.168.1.10\" reject'<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"SELinux_and_Networking\"><\/span><strong>SELinux and Networking<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>SELinux can restrict network services.<\/p>\n\n\n\n<p>Check status:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">getenforce<\/pre>\n\n\n\n<p>Allow HTTP connections:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">setsebool -P httpd_can_network_connect 1<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Performance_Optimization_Tips\"><\/span><strong>Performance Optimization Tips<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <strong>ethtool<\/strong> to optimize NIC performance:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">ethtool -K eth0 tso off gso off<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Monitor bandwidth:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">nload<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check latency:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">ping -c 5 google.com<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Analyze traffic:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">tcpdump -i eth0<br><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Pro_Tips_for_Real-World_Usage\"><\/span>Pro Tips for Real-World Usage<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Persistent setup<\/strong>: Always set <code>ONBOOT=yes<\/code> or <code>autoconnect yes<\/code> to ensure your network starts on boot.<\/li>\n\n\n\n<li><strong>Name consistency<\/strong>: Use labels like <code>ENP0<\/code> and <code>ENP1<\/code> for clarity when managing multiple interfaces.<\/li>\n\n\n\n<li><strong>Avoid conflicts<\/strong>: When using both <code>nmcli<\/code> and <code>ifcfg<\/code> files, make sure NetworkManager isn\u2019t trying to do double duty.<\/li>\n\n\n\n<li><strong>Multiple gateways<\/strong>: To control traffic routes, use a <code>route-eth1<\/code> file or <code>nmcli connection modify \u2026 ipv4.route... metric<\/code>. This is excellent for complex setups or failover networking.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Troubleshooting_Table\"><\/span>Troubleshooting Table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Problem<\/th><th>Resolution<\/th><\/tr><\/thead><tbody><tr><td>The interface doesn&#8217;t start on boot<\/td><td>Check <code>ONBOOT=yes<\/code> or <code>autoconnect yes<\/code><\/td><\/tr><tr><td>IP didn\u2019t change after editing<\/td><td>Run <code>systemctl restart NetworkManager<\/code><\/td><\/tr><tr><td>DNS issues<\/td><td>Double-check <code>\/etc\/resolv.conf<\/code> or DNS lines in <code>ifcfg-*<\/code><\/td><\/tr><tr><td>Firewall interference<\/td><td>Use <code>firewall-cmd --list-all<\/code> to ensure network zones and ports are open<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Final_Thoughts\"><\/span><strong>Final Thoughts<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Configuring networking on CentOS 7 and 8 is more than just assigning an IP address; it\u2019s about building a stable, secure, and high-performance foundation for your server environment. From understanding core networking layers to implementing advanced configurations, mastering these skills allows you to take full control of your infrastructure.<\/p>\n\n\n\n<p>By choosing the right configuration method (static or DHCP), using modern tools, and following best practices, you can ensure consistent connectivity, improved security, and scalable performance. Regular testing and monitoring further help in maintaining reliability and avoiding unexpected downtime.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FAQs\"><\/span><strong>FAQs<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Q1: Should I stick with nmcli or scripts?<\/strong><br>For automation and modern environments, <code>nmcli<\/code> it is the better choice. For simple, single-server setups, traditional network scripts can be easier to edit and manage.<\/p>\n\n\n\n<p><strong>Q2: What should I do if my interface name changes unexpectedly?<\/strong><br>Update the interface name in your configuration file and reload NetworkManager using:<br><code>systemctl reload NetworkManager<\/code><\/p>\n\n\n\n<p><strong>Q3: What if I need IPv6 configuration?<\/strong><br>You can configure IPv6 just like IPv4. For example, use <code>ipv6.method auto<\/code> for automatic assignment or manually define <code>ipv6.addresses<\/code>.<\/p>\n\n\n\n<p><strong>Q4: Can I apply network changes without restarting the server?<\/strong><br>Yes, most changes can be applied by restarting the interface or NetworkManager without requiring a full system reboot.<\/p>\n\n\n\n<p><strong>Q5: How do I make network settings persistent after a reboot?<\/strong><br>Ensure your configuration files or <code>nmcli<\/code> settings are saved properly and that NetworkManager is enabled to start on boot.<\/p>\n\n\n\n<p><strong>Q6: What is the difference between nmcli and nmtui?<\/strong><br><code>nmcli<\/code> It is a command-line tool ideal for scripting and automation, while nmtui provides a user-friendly text interface for quick manual configurations.<\/p>\n\n\n\n<p><strong>Q7: Why is my network not connecting after configuration?<\/strong><br>This could be due to incorrect IP settings, gateway issues, DNS misconfiguration, or firewall restrictions. Always verify each parameter carefully.<\/p>\n\n\n\n<p><strong>Q8: How can I check if my network is working properly?<\/strong><br>Use commands like <code>ping<\/code>, <code>ip a<\/code>, and <code>ip route<\/code> to verify connectivity, IP assignment, and routing.<\/p>\n\n\n\n<p><strong>Q9: Can I configure multiple IP addresses on one interface?<\/strong><br>Yes, CentOS supports multiple IPs on a single interface, which is useful for hosting multiple services or websites.<\/p>\n\n\n\n<p><strong>Q10: Is NetworkManager required in CentOS 8?<\/strong><br>Yes, CentOS 8 primarily relies on NetworkManager, and it is recommended to use it for all network configurations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Suggestions\"><\/span>Suggestions:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/mainvps.net\/blog\/linux-reseller-hosting\/\">https:\/\/mainvps.net\/blog\/linux-reseller-hosting\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/lifetime-web-hosting-2026\/\">https:\/\/mainvps.net\/blog\/lifetime-web-hosting-2026\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/windows-reseller-web-hosting\/\">https:\/\/mainvps.net\/blog\/windows-reseller-web-hosting\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/best-wordpress-hosting-providers\/\">https:\/\/mainvps.net\/blog\/best-wordpress-hosting-providers\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/linux-vps-hosting-india\/\">https:\/\/mainvps.net\/blog\/linux-vps-hosting-india\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/low-cost-windows-vps-hosting-in-india\/\">https:\/\/mainvps.net\/blog\/low-cost-windows-vps-hosting-in-india\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/cheap-dedicated-server-hosting-providers\/\">https:\/\/mainvps.net\/blog\/cheap-dedicated-server-hosting-providers\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/windows-server-guide-dde-dns-tls-1-2-uptime\/\">https:\/\/mainvps.net\/blog\/windows-server-guide-dde-dns-tls-1-2-uptime\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/dedicated-server-hosting-netherlands\/\">https:\/\/mainvps.net\/blog\/dedicated-server-hosting-netherlands\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/dedicated-server-low-price\/\">https:\/\/mainvps.net\/blog\/dedicated-server-low-price\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/vps-hosting-in-los-angeles-us\/\">https:\/\/mainvps.net\/blog\/vps-hosting-in-los-angeles-us\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/dedicated-server-in-nedzone-nl\/\">https:\/\/mainvps.net\/blog\/dedicated-server-in-nedzone-nl\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/buy-linux-vps-hosting\/\">https:\/\/mainvps.net\/blog\/buy-linux-vps-hosting\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/managed-windows-vps-hosting\/\">https:\/\/mainvps.net\/blog\/managed-windows-vps-hosting\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/host-foundry-on-ubuntu-server\/\">https:\/\/mainvps.net\/blog\/host-foundry-on-ubuntu-server\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/mainvps.net\/blog\/what-is-wmi-provider-host-complete-guide\/\">https:\/\/mainvps.net\/blog\/what-is-wmi-provider-host-complete-guide\/<\/a><\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A dedicated IP is literally an IP address that is only assigned to you, whereas a VPS, or Virtual Private Server, is a complete server with <a class=\"read-more-link\" href=\"https:\/\/mainvps.net\/blog\/configure-networking-centos-7-8-guide\/\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":11882,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-11682","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-hosting"],"_links":{"self":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts\/11682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/comments?post=11682"}],"version-history":[{"count":3,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts\/11682\/revisions"}],"predecessor-version":[{"id":12482,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/posts\/11682\/revisions\/12482"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/media\/11882"}],"wp:attachment":[{"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/media?parent=11682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/categories?post=11682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mainvps.net\/blog\/wp-json\/wp\/v2\/tags?post=11682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}