{"id":394,"date":"2021-02-13T12:59:18","date_gmt":"2021-02-13T11:59:18","guid":{"rendered":"http:\/\/huf.org\/wp\/?p=394"},"modified":"2021-02-13T13:00:05","modified_gmt":"2021-02-13T12:00:05","slug":"adding-static-ip-and-routes-to-etc-interface-in-debian-10-buster","status":"publish","type":"post","link":"https:\/\/huf.org\/wp\/?p=394","title":{"rendered":"adding static ip and routes to \/etc\/interface in debian 10 &#8222;buster&#8220;"},"content":{"rendered":"\n<p class=\"has-text-align-right\"><em>&#8222;The times they are a-changing&#8220; &#8211; Bob Dylan<\/em><\/p>\n\n\n\n<p>however grave the problems were that dylan <a href=\"https:\/\/en.wikipedia.org\/wiki\/The_Times_They_Are_a-Changin%27_(Bob_Dylan_album)\">addressed<\/a> in his song and 1963 album, he certainly didn&#8217;t envision how linux distributions like debian are a-changing the way in which we have to configure our network settings. if we look at how we define static ip addresses, we can see quite some dylan-esque transitions. and when you need to persistently define <strong>static routes<\/strong>, keeping up-to-date can be at least hard.<\/p>\n\n\n\n<p>it&#8217;s been hardly nine months since my post about <a href=\"http:\/\/huf.org\/wp\/?p=355\">static routes in debian 9<\/a> when that method has been marked as &#8222;deprecated&#8220; and won&#8217;t actually work anymore in debian 10 &#8222;buster&#8220;. So here&#8217;s how to do both <strong>static ip and static routes<\/strong> in buster:<\/p>\n\n\n\n<p>the good thing is, it&#8217;s now all in one file. just edit \/etc\/network\/interfaces. for the not-so daring types, make a backup before the edit: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&gt; sudo cp \/etc\/network\/interfaces \/etc\/network\/interfaces.orig<\/code><br \/><br \/><code>&gt; sudo vi \/etc\/network\/interfaces<\/code><\/pre>\n\n\n\n<p>an out-of-the-box install will most certainly have dhcp configured. So for static ip, we comment out (or delete) these lines:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code># allow-hotplug ens18<\/code><br \/><code># iface ens18 inet dhcp<\/code><\/pre>\n\n\n\n<p><code>ens18<\/code> is the interface name in this example. that can be <code>eth0<\/code> or <code>en0<\/code> or something else in your case. <\/p>\n\n\n\n<p>In order to set the <strong>static ipv4 address<\/strong> for the machine, insert this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code># static ip address on interface ens18 (or whatever the name):<\/code><br \/><code>address 192.168.1.100<\/code><br \/><code>netmask 255.255.255.0<\/code><br \/><code>gateway 192.168.1.1<\/code><br \/><code>dns-domain fritz.box<\/code><br \/><code>dns-nameservers 192.168.1.1 8.8.8.8<\/code><\/pre>\n\n\n\n<p>&#8230;of course you have to adapt the adress scheme to your network setup.<\/p>\n\n\n\n<p>right after this we&#8217;ll add the <strong>static route <\/strong>which has been moved from the <code>route<\/code> system command to the more general <code>ip<\/code> tool:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code># for a network route:<\/code><br \/><code>up \/bin\/ip route add 192.168.10.0\/24 via 192.168.1.10<\/code><br \/><br \/><code># and for a host route:<\/code><br \/><code>up \/bin\/ip route add 192.168.10.10\/32 via 192.168.1.10<\/code><\/pre>\n\n\n\n<p>of course you know that the latter &#8211; a host route &#8211; is merely a special case of the more general classless routing notation above&#8230;<\/p>\n\n\n\n<p>ok, my little furry creatures. till next time in our series &#8222;fun with the a-changing linux concept of static routes&#8220;. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8222;The times they are a-changing&#8220; &#8211; Bob Dylan however grave the problems were that dylan addressed in his song and 1963 album, he certainly didn&#8217;t envision how linux distributions like debian are a-changing the way in which we have to &hellip; <a href=\"https:\/\/huf.org\/wp\/?p=394\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-394","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/huf.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/huf.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/huf.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/huf.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/huf.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=394"}],"version-history":[{"count":2,"href":"https:\/\/huf.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/394\/revisions"}],"predecessor-version":[{"id":397,"href":"https:\/\/huf.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/394\/revisions\/397"}],"wp:attachment":[{"href":"https:\/\/huf.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/huf.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/huf.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}