{"id":16598,"date":"2023-10-24T10:46:11","date_gmt":"2023-10-24T10:46:11","guid":{"rendered":"https:\/\/cloudpap.com\/?post_type=docs&#038;p=16598"},"modified":"2023-10-24T10:46:13","modified_gmt":"2023-10-24T10:46:13","password":"","slug":"how-to-check-network-configuration-in-centos","status":"publish","type":"docs","link":"https:\/\/cloudpap.com\/blog\/docs\/how-to-check-network-configuration-in-centos\/","title":{"rendered":"How to Check Network Configuration in CentOS"},"content":{"rendered":"\n<p>In CentOS, you can check and verify the network configuration by examining the settings in the <code>\/etc\/sysconfig\/network-scripts\/ifcfg-&lt;interface><\/code> files. Each network interface has its own configuration file in this directory, typically named <code>ifcfg-&lt;interface><\/code>, where <code>&lt;interface><\/code> represents the name of the network interface. At CloudPap, the most likely interface name is enp1s0 (e.g., <code>ifcfg-enp1s0<\/code> for the first Ethernet interface). Here are the specific steps to do this:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Login to the VM<\/strong>: Login to the VM via SSH using the command below<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ssh centos@IP_ADDRESS<\/code><\/pre>\n\n\n\n<p>2.<strong>Identify the Network Interface<\/strong>: First, identify the network interface that you want to check and verify. You can use the <code>ifconfig<\/code> or <code>ip addr<\/code> command to list all the network interfaces on your system and their names. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   ifconfig<\/code><\/pre>\n\n\n\n<p>This command will display a list of network interfaces, such as <code><code>enp1s0<\/code><\/code>, <code>eth0<\/code>, or others. Note the name of the interface you want to inspect.<\/p>\n\n\n\n<p>3.<strong>View the Interface Configuration File<\/strong>: Now, open the configuration file for the chosen network interface using a text editor such as vim. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   sudo vim \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/code><\/pre>\n\n\n\n<p>You will need root privileges to edit this file, hence the <code>sudo<\/code> command.<\/p>\n\n\n\n<p>5.<strong>Review the Configuration File<\/strong>: The configuration file (<code>ifcfg-<code>enp1s0<\/code><\/code>) contains various parameters for the network interface. Typical contents include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   DEVICE=enp1s0\n   BOOTPROTO=none\n   ONBOOT=yes\n   TYPE=Ethernet\n   IPADDR=192.168.1.10\n   NETMASK=255.255.255.0\n   GATEWAY=192.168.1.1\n   DNS1=8.8.8.8<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>DEVICE<\/code>: Specifies the name of the network interface.<\/li>\n\n\n\n<li><code>BOOTPROTO<\/code>: Indicates the method of obtaining an IP address (e.g., <code>dhcp<\/code> for DHCP or <code>static<\/code> for a manually configured IP).<\/li>\n\n\n\n<li><code>ONBOOT<\/code>: Set to &#8220;yes&#8221; if the interface should be started during boot.<\/li>\n\n\n\n<li><code>TYPE<\/code>: Specifies the interface type (usually &#8220;Ethernet&#8221;).<\/li>\n\n\n\n<li><code>IPADDR<\/code>, <code>NETMASK<\/code>, <code>GATEWAY<\/code>: Define the IP address, subnet mask, and default gateway, respectively.<\/li>\n\n\n\n<li><code>DNS1<\/code>, <code>DNS2<\/code>: Specify DNS server IP addresses.<\/li>\n<\/ul>\n\n\n\n<p>6.<strong>Verify the Configuration<\/strong>: Carefully review the settings in the configuration file to ensure they match your network requirements. Check for potential issues such as incorrect IP addresses, gateway settings, or DNS configurations.<\/p>\n\n\n\n<p>7.<strong>Save and Exit<\/strong>: If you make any changes to the configuration file, save your modifications. In the <code>nano<\/code> or <code>vi<\/code> editor, you can typically save by pressing <code>Ctrl + O<\/code>, confirming the file name, and pressing <code>Enter<\/code>. To exit, press <code>Ctrl + <\/code>x.<\/p>\n\n\n\n<p>8.<strong>Check Network Configuration<\/strong>: After reviewing and potentially modifying the configuration file, you can check the network configuration for the interface by using the <code>ifconfig<\/code> or <code>ip addr<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   ifconfig<\/code><\/pre>\n\n\n\n<p>This will display the current network interface settings. Verify that the information you see in the output matches the settings you have defined in the configuration file.<\/p>\n\n\n\n<p>By following these steps, you can check and verify the network configuration for a specific network interface in CentOS. If there are any discrepancies or issues, you may need to make adjustments to the configuration file and restart the network service to apply the changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In CentOS, you can check and verify the network configuration by examining the settings in the \/etc\/sysconfig\/network-scripts\/ifcfg-&lt;interface> files. Each network interface has its own configuration file in this directory, typically named ifcfg-&lt;interface>, where &lt;interface> represents the name of the network interface. At CloudPap, the most likely interface name is enp1s0 (e.g., ifcfg-enp1s0 for the first&#8230;<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"doc_category":[127,128],"doc_tag":[445],"class_list":["post-16598","docs","type-docs","status-publish","hentry","doc_category-servers","doc_category-vps","doc_tag-centos-network-networking"],"year_month":"2026-04","word_count":475,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Wallace","author_nicename":"wallace","author_url":"https:\/\/cloudpap.com\/blog\/author\/wallace\/"},"doc_category_info":[{"term_name":"Servers","term_url":"https:\/\/cloudpap.com\/blog\/docs-category\/servers\/"},{"term_name":"VPS","term_url":"https:\/\/cloudpap.com\/blog\/docs-category\/vps\/"}],"doc_tag_info":[{"term_name":"Centos Network, Networking","term_url":"https:\/\/cloudpap.com\/blog\/docs-tag\/centos-network-networking\/"}],"_links":{"self":[{"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/docs\/16598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/comments?post=16598"}],"version-history":[{"count":0,"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/docs\/16598\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/media?parent=16598"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/doc_category?post=16598"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/cloudpap.com\/blog\/wp-json\/wp\/v2\/doc_tag?post=16598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}