{"id":2508,"date":"2020-01-31T18:06:40","date_gmt":"2020-01-31T18:06:40","guid":{"rendered":"https:\/\/lamp.ciscoar.com\/?page_id=2508"},"modified":"2020-01-31T19:21:51","modified_gmt":"2020-01-31T19:21:51","slug":"disabling-dhcp-on-centos-7","status":"publish","type":"page","link":"https:\/\/lamp.ciscoar.com\/?page_id=2508","title":{"rendered":"Disabling DHCP on CentOS 7"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\"> How to disable DHCP on Linux CentOS 7 using WinSCP <\/h2>\n\n\n\n<p>We&#8217;ve already discussed about the why it is needed to disable DHCP in <a href=\"\/dhcp\/#Why_we_have_to_disable_DHCP\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">this article<\/a>, let&#8217;s  move forward and complete this important task.<\/p>\n\n\n\n<p>It is quite probably that you&#8217;re going to find many tutorials about changing the DHCP settings using one of the widely used and very well-known text editors, &#8220;vi&#8221; or &#8220;nano&#8221;, if so, if you already know how to do it from the CLI then you can enrich your knowledge with this article because we&#8217;re going disable DHCP using the 100% GUI(Graphical User Interface) that&#8217;s provided by WinSCP.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Network Script location<\/h2>\n\n\n\n<p>The small text file containing all the Network settings is located in the following folder:<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: calibri;font-weight: 700;font-size: 20px;color: #9b51e0\">\/etc\/sysconfig\/network-scripts<\/p>\n\n\n<p>You can take advantage of the WinSCP&#8217;s bookmarks to go directly to that folder, see animation below, if you want to learn how to create a bookmark on WinSCP please take a look at <a href=\"\/winscp-bookmarks\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"this article (opens in a new tab)\">this article<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"652\" height=\"432\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-open-bookmark.gif\" alt=\"\" class=\"wp-image-2517\"\/><figcaption>Opening a WinSCP bookmark<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Network script name enp0s3<\/h2>\n\n\n\n<p>If you want to know which text file contains all the network settings you can take a look at <a href=\"\/centos-ip-address\/\">this article<\/a> where we discussed about the Network Adapter and how to check the IP Address that was automatically assigned by DHCP.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to open the network script<\/h2>\n\n\n\n<p>WinSCP allow us to open text files using both an internal editor (default option) or the text editor of your preference, in this case we&#8217;re going to use the one that comes by default.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-opening-network-script.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"467\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-opening-network-script.jpg\" alt=\"\" class=\"wp-image-2533\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-opening-network-script.jpg 564w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-opening-network-script-300x248.jpg 300w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/a><figcaption>WinSCP editing a text file<\/figcaption><\/figure><\/div>\n\n\n\n<p>If you want to accelerate a little bit the opening on a text file you can just double click and the default text editor will be used to open the file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Network script example<\/h2>\n\n\n\n<p>The following image shows a typical network script, as you can see it&#8217;s just a text file containing all the parameters related to the Network, in particular we&#8217;re going to change the Boot Protocol, see image below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-dhcp-enabled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"646\" height=\"376\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-dhcp-enabled.jpg\" alt=\"\" class=\"wp-image-2536\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-dhcp-enabled.jpg 646w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/winscp-dhcp-enabled-300x175.jpg 300w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/a><figcaption>Network script with DHCP enabled<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What needs to be changed?<\/h2>\n\n\n\n<p>The first thing we want to change is the BOOTPROTO line, we must replace &#8220;<strong>dhcp<\/strong>&#8221; with &#8220;<strong>none<\/strong>&#8221; that simple step will tell the system that DCHP will no longer be used for this particular network adapter.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/centos7-dhcp-boot-protocol-none.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"397\" height=\"450\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/centos7-dhcp-boot-protocol-none.jpg\" alt=\"\" class=\"wp-image-2540\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/centos7-dhcp-boot-protocol-none.jpg 397w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/centos7-dhcp-boot-protocol-none-265x300.jpg 265w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What needs to be added?<\/h2>\n\n\n\n<p>Now that DHCP was disabled we must manually tell the system which IP addressing it must use for this particular network adapter, here you have the typical settings for a home network, you can always double check these settings on your Windows machine to be sure everything is ok, take a look at <a rel=\"noreferrer noopener\" aria-label=\"this article (opens in a new tab)\" href=\"\/dhcp\/#How_to_check_the_IP_Addressing_on_Windows\" target=\"_blank\">this article<\/a>.<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: calibri;font-weight: 700;font-size: 20px;color: #9b51e0\">IPADDR=192.168.0.21<br>NETMASK=255.255.255.0<br>GATEWAY=192.168.0.1<br>DNS1=192.168.0.1<\/p>\n\n\n<h2 class=\"wp-block-heading\">DHCP is now disabled<\/h2>\n\n\n\n<p>Once you&#8217;ve completed the needed changes, the final version will looks like the following image, I&#8217;ve highlighted the lines that were changed or added.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/network-script-after-changes-dhcp-disabled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"408\" height=\"459\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/network-script-after-changes-dhcp-disabled.jpg\" alt=\"\" class=\"wp-image-2543\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/network-script-after-changes-dhcp-disabled.jpg 408w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/network-script-after-changes-dhcp-disabled-267x300.jpg 267w\" sizes=\"auto, (max-width: 408px) 100vw, 408px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Close the text file saving the changes<\/h2>\n\n\n\n<p>Save the file as usual, just click the little icon shaped as a floppy disk located at the upper left corner, see image below, and then feel free to close the window.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/dhcp-disabled-saving-changes.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"538\" height=\"403\" src=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/dhcp-disabled-saving-changes.jpg\" alt=\"\" class=\"wp-image-2545\" srcset=\"https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/dhcp-disabled-saving-changes.jpg 538w, https:\/\/lamp.ciscoar.com\/wp-content\/uploads\/2020\/01\/dhcp-disabled-saving-changes-300x225.jpg 300w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/a><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Restart the Network and check connectivity<\/h2>\n\n\n\n<p>The final step, as you can imagine is to restart the network, I&#8217;ve already told you that we are going to use both methods, the CLI and the GUI, well this is the perfect moment to use the CLI, we can restart the network using the following CLI command.<\/p>\n\n\n<p class=\"fonts-plugin-block \" style=\"font-family: calibri;font-weight: 700;font-size: 20px;color: #9b51e0\">systemctl restart network.service<\/p>\n\n\n<p>This step must be done either by the super user &#8220;root&#8221; (usually in a LAB Environment) or with power user with &#8220;sudo&#8221; privileges (real world scenario).<\/p>\n\n\n\n<p>Immediately after restarting the network be sure that connectivity is still working as it should, for that you can take a look at <a rel=\"noreferrer noopener\" aria-label=\"this article (opens in a new tab)\" href=\"\/lan-and-wan-connectivity\/\" target=\"_blank\">this article<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to disable DHCP on Linux CentOS 7 using WinSCP We&#8217;ve already discussed about the why it is needed to disable DHCP in this article, let&#8217;s move forward and complete this important task. It is quite probably that you&#8217;re going to find many tutorials about changing the DHCP settings using one of the widely used &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lamp.ciscoar.com\/?page_id=2508\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Disabling DHCP on CentOS 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2508","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/2508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2508"}],"version-history":[{"count":29,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/2508\/revisions"}],"predecessor-version":[{"id":2562,"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=\/wp\/v2\/pages\/2508\/revisions\/2562"}],"wp:attachment":[{"href":"https:\/\/lamp.ciscoar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}