{"id":2356,"date":"2020-12-05T10:55:22","date_gmt":"2020-12-05T10:55:22","guid":{"rendered":"https:\/\/linuxways.net\/?p=2356"},"modified":"2020-12-05T10:55:25","modified_gmt":"2020-12-05T10:55:25","slug":"how-to-configure-static-ip-in-debian-10","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-configure-static-ip-in-debian-10\/","title":{"rendered":"How to Configure Static IP in Debian 10"},"content":{"rendered":"<p>When you install a new OS, by default it is configured to obtain a dynamic IP address from the DHCP server. However, sometimes you have to configure the static IP address on your machine. It can be for various reasons like when a service needs to connect through an IP address instead of a domain name or when you are hosting a web server or to give someone remote access to your system. Whatever the reason is, you must know how to configure a static IP in your system. This post will explain to you how to do this.<\/p>\n<p>You can configure static IP in Debian 10 system using any of the following methods:<\/p>\n<ul>\n<li>Configure Static IP through Command Line<\/li>\n<li>Configure Static IP through GUI<\/li>\n<\/ul>\n<p>Let&#8217;s get started.<\/p>\n<h2>Configure Static IP through Command Line<\/h2>\n<p>You can configure the static IP through \/etc\/network\/interfaces file from your command line. However, for this, you first need to know the network interface name.<\/p>\n<p>You can find the currently available network interface by running the below command in Terminal:<\/p>\n<pre>$ ip a<\/pre>\n<p>After running the above command, we received the following output.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"826\" height=\"364\" class=\"wp-image-2357\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-66.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-66.png 826w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-66-300x132.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-66-768x338.png 768w\" sizes=\"auto, (max-width: 826px) 100vw, 826px\" \/> The above output of \u201cip a\u201d command shows that there are two interfaces currently available. We want to configure the static IP for the interface <strong>ens33<\/strong>. The current IP address of ens33 is 192.168.72.158 which is dynamically assigned by the DHCP.<\/p>\n<p>Now we will open the interface configuration file and configure static IP for ens33.<\/p>\n<p>To open network interface configuration file, execute the following command:<\/p>\n<pre>$ sudo nano \/etc\/network\/interfaces<\/pre>\n<p>Then add lines in the following syntax replacing the interface with your network interface name and <strong>xxx.xxx.xxx.xxx<\/strong> with the relevant IP address.<\/p>\n<pre>auto <strong>interface<\/strong><\/pre>\n<pre>iface <strong>interface<\/strong> inet static<\/pre>\n<pre>address <strong>xxx.xxx.xxx.xxx<\/strong> #enter your IP address<br \/><br \/>netmask <strong>xxx.xxx.xxx.xxx<\/strong><br \/><br \/>gateway <strong>xxx.xxx.xxx.xxx<\/strong> #enter gateway ip address<br \/><br \/>dns-nameservers <strong>xxx.xxx.xxx.xxx<\/strong><\/pre>\n<p>For our network interface ens33, we have modified the configuration lines as follows:<\/p>\n<pre>auto <strong>ens33<\/strong><br \/><br \/>iface <strong>ens33<\/strong> inet static<br \/><br \/>address <strong>192.168.72.159<\/strong><br \/><br \/>netmask <strong>255.255.255.0<\/strong><br \/><br \/>gateway <strong>192.168.72.2 <\/strong><br \/><br \/>dns-nameservers <strong>8.8.8.8 8.8.4.4<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"611\" height=\"420\" class=\"wp-image-2358\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-67.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-67.png 611w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-67-300x206.png 300w\" sizes=\"auto, (max-width: 611px) 100vw, 611px\" \/><\/p>\n<p>Once you have completed the configurations, save and close the file.<\/p>\n<p>Then restart the networking services. Use the below command to do so:<\/p>\n<pre>$ sudo systemctl restart networking.service<\/pre>\n<p>You can also use the <strong>ifdown<\/strong> and <strong>ifup<\/strong> command to apply the configuration changes. First, run the <strong>ifdown <\/strong>command to bring down the interface:<\/p>\n<pre>$ ifdown ens33<\/pre>\n<p>Then bring up the interface using <strong>ifup<\/strong>:<\/p>\n<pre>$ ifup ens33<\/pre>\n<p>Now to verify if the IP address has been changed successfully, issue the below command in Terminal:<\/p>\n<pre>$ ip a<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"833\" height=\"317\" class=\"wp-image-2359\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-68.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-68.png 833w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-68-300x114.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-68-768x292.png 768w\" sizes=\"auto, (max-width: 833px) 100vw, 833px\" \/><\/p>\n<h2>Configure Static IP through GUI<\/h2>\n<p>You can also change the static IP through the <strong>Settings<\/strong> utility in your Debian system. To launch the Settings utility in your system, right-click the desktop and then click <strong>Settings<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"440\" height=\"309\" class=\"wp-image-2360\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-69.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-69.png 440w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-69-300x211.png 300w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/p>\n<p>Then from the left pane in the Settings window, select the<strong> Network<\/strong> tab.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"870\" height=\"505\" class=\"wp-image-2361\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-70.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-70.png 870w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-70-300x174.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-70-768x446.png 768w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><\/p>\n<p>On the right pane, click the cog icon in front of the network interface you want to configure.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"497\" class=\"wp-image-2362\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-71.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-71.png 857w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-71-300x174.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-71-768x445.png 768w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/p>\n<p>This will open the following configuration window where you will see the current IP 192.168.72.158 which is the IP address obtained from DHCP server. Go to <strong>IPv4<\/strong> tab.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"649\" height=\"553\" class=\"wp-image-2363\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-72.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-72.png 649w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-72-300x256.png 300w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/p>\n<p>Then in the <strong>IPv4<\/strong> <strong>Method<\/strong>, choose <strong>Manual<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"649\" height=\"458\" class=\"wp-image-2364\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-73.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-73.png 649w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-73-300x212.png 300w\" sizes=\"auto, (max-width: 649px) 100vw, 649px\" \/><\/p>\n<p>Now the <strong>Addresses<\/strong> field will appear. Enter the IP address, Netmask, and Gateway for your interface. If you also want to set the DNS address manually, switch off the <strong>Automatic<\/strong> button and enter the DNS server address.<\/p>\n<p>Here, we have specified 192.168.72.159 as our interface IP address, 255.255.255.0 as netmask, and the 192.168.72.2 ad the default gateway. Then we have specified 8.8.8.8 and 8.8.4.4 as our DNS servers.<\/p>\n<p>Now click the <strong>Apply<\/strong> button to apply all the configuration changes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"555\" class=\"wp-image-2365\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-74.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-74.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/12\/word-image-74-300x258.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<p>Now to confirm if the new IP address has been successfully configured, go to the <strong>Details<\/strong> tab. Alternatively, you can also use the &#8220;ip a&#8221; command in Terminal to verify the IP address.<\/p>\n<p>There you have the static IP configuration in Debian 10. Using either the command line or GUI method, you can easily configure the static IP address on your system.<\/p>\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>When you install a new OS, by default it is configured to obtain a dynamic IP address from the DHCP server. However, sometimes you have to configure the&hellip;<\/p>","protected":false},"author":4,"featured_media":2366,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[17,97,98],"class_list":["post-2356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","tag-debian-10","tag-ip-address","tag-static-ip"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/2356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=2356"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/2356\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/2366"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=2356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=2356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=2356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}