{"id":207,"date":"2008-12-29T12:15:12","date_gmt":"2008-12-29T17:15:12","guid":{"rendered":"http:\/\/it.thelibrarie.com\/weblog\/?p=207"},"modified":"2022-12-02T08:30:09","modified_gmt":"2022-12-02T14:30:09","slug":"ubuntu-command-line-change-ip-settings","status":"publish","type":"post","link":"https:\/\/it.thelibrarie.com\/weblog\/2008\/12\/ubuntu-command-line-change-ip-settings\/","title":{"rendered":"Ubuntu Command Line Change IP Settings"},"content":{"rendered":"<p>I find myself forgetting more and more when I use tools like webmin.  These usually work with most flavors of linux as well.<\/p>\n<p><code>sudo nano \/etc\/networking\/interfaces<\/code><\/p>\n<blockquote><p>auto eth0<br>\niface eth0 inet static<br>\naddress 192.168.3.90<br>\ngateway 192.168.3.1<br>\nnetmask 255.255.255.0<br>\nnetwork 192.168.3.0<br>\nbroadcast 192.168.3.255<\/p><\/blockquote>\n<p>Then restart the networking devices<br>\n<code>sudo \/etc\/init.d\/networking restart<\/code><\/p>\n<p>*** EDIT 10\/4\/2017 ***<br>\nAlmost a decade later and I had to update this slightly.<\/p>\n<p><strong>List Your Available Network Devices<\/strong><br>\n<code>ifconfig -a<\/code><\/p>\n<p><strong>List Your Currently Enabled\/Working Network Devices<\/strong><br>\n<code>ifconfig<\/code><\/p>\n<p><strong>Edit Your Network Device<\/strong><br>\nnano \/etc\/network\/interfaces<\/p>\n<blockquote><p>auto ens32<br>\niface ens32 inet static<br>\naddress 192.168.3.90<br>\ngateway 192.168.3.1<br>\nnetmask 255.255.255.0<br>\nnetwork 192.168.3.0<br>\nbroadcast 192.168.3.255<br>\ndns-nameservers 192.168.3.2 192.168.3.3<br>\ndns-search domainname.local<\/p><\/blockquote>\n<p><strong>Restart Your Network Device<\/strong><br>\n<code>ifdown ens32 &amp;&amp; ifup ens32<\/code><\/p>\n<p>*** EDIT 1\/12\/2018 ***<br>\nOnly a few months later, but Ubuntu started using netplan instead of the usual ifup\/ifconfig commands I&#8217;m used to. Now it&#8217;s yaml.<br>\nThis is for 17.10 and later! Proper space is NEEDED to work.<\/p>\n<p><a href=\"https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2008\/12\/netplan.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2008\/12\/netplan.png\" alt=\"\" width=\"562\" height=\"262\" class=\"alignnone size-full wp-image-1388\" srcset=\"https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2008\/12\/netplan.png 562w, https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2008\/12\/netplan-300x140.png 300w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/a><br>\n<code>nano \/etc\/netplan\/01-netcfg.yaml<\/code><\/p>\n<blockquote><p>network:<br>\n  version: 2<br>\n  renderer: networkd<br>\n  ethernets:<br>\n    ens32:<br>\n      dhcp4: no<br>\n      addresses: [10.1.10.114\/24,&#8217;IPV6HEREIFYOUWANT&#8217;]<br>\n      gateway4: 10.1.10.1<br>\n      nameservers:<br>\n        search: [domain.local, otherdomain.tld]<br>\n        addresses: [10.1.10.2, 10.2.10.2]<\/p><\/blockquote>\n<p><code>netplan apply<\/code><\/p>\n\n\n<p>*** EDIT 2022-12-02 ***<\/p>\n\n\n\n<p>Apparently this changed in Ubuntu 20.04 (although it still supported the &#8220;old way&#8221;), but in 22.04 I could not get netplan to support my use of the gateway4 option.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2022\/12\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"336\" src=\"https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2022\/12\/image.png\" alt=\"\" class=\"wp-image-1560\" srcset=\"https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2022\/12\/image.png 687w, https:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2022\/12\/image-300x147.png 300w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><\/a><figcaption class=\"wp-element-caption\">I&#8217;ve left the old style commented out, but the new way of using only routes for this purpose works well and opens up the idea of multiple gateways or static routes from a single system.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I find myself forgetting more and more when I use tools like webmin. These usually work with most flavors of linux as well. sudo nano \/etc\/networking\/interfaces auto eth0 iface eth0 inet static address 192.168.3.90 gateway 192.168.3.1 netmask 255.255.255.0 network 192.168.3.0 broadcast 192.168.3.255 Then restart the networking devices sudo \/etc\/init.d\/networking restart *** EDIT 10\/4\/2017 *** Almost &hellip; <a href=\"https:\/\/it.thelibrarie.com\/weblog\/2008\/12\/ubuntu-command-line-change-ip-settings\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Ubuntu Command Line Change IP Settings<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":7,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":1561,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/207\/revisions\/1561"}],"wp:attachment":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}