{"id":55,"date":"2013-05-18T22:18:47","date_gmt":"2013-05-18T12:18:47","guid":{"rendered":"http:\/\/wp.eejin.org\/?p=55"},"modified":"2013-05-18T22:18:47","modified_gmt":"2013-05-18T12:18:47","slug":"change-ubuntu-server-from-dhcp-to-a-static-ip-address","status":"publish","type":"post","link":"https:\/\/wp.eejin.org\/?p=55","title":{"rendered":"Change Ubuntu Server from DHCP to a Static IP Address"},"content":{"rendered":"<h2>Ubuntu Server after installation has set your server to use DHCP. you will need to change to a static IP address so that people can actually use it.<\/h2>\n<p>How to you change without using GUI.<\/p>\n<ol>\n<li>1.Changing this setting without a GUI will require some text editing, but that\u2019s classic linux, right?<\/li>\n<li>Let\u2019s open up the \/etc\/network\/interfaces file. And use vi, but you can choose a different editor<\/li>\n<\/ol>\n<div>\n<blockquote><p>sudo vi \/etc\/network\/interfaces<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<ol>\n<li>For the primary interface, which is usually eth0, you will see these lines:<\/li>\n<\/ol>\n<blockquote><p>auto eth0<br \/>\niface eth0 inet dhcp<\/p>\n<p>&nbsp;<\/p><\/blockquote>\n<ol>\n<li>It\u2019s using DHCP right now. To change that you need to add a number of options. Obviously you\u2019d customize this to your network.<\/li>\n<\/ol>\n<blockquote><p>auto eth0<br \/>\niface eth0 inet static<br \/>\naddress 192.168.1.100<br \/>\nnetmask 255.255.255.0<br \/>\nnetwork 192.168.1.0<br \/>\nbroadcast 192.168.1.255<br \/>\ngateway 192.168.1.1<\/p><\/blockquote>\n<p>Now we\u2019ll need to add in the DNS settings by editing the resolv.conf file:<\/p>\n<blockquote><p>sudo vi \/etc\/resolv.conf<\/p><\/blockquote>\n<p>On the line \u2018name server xxx.xxx.xxx.xxx\u2019 replace the x with the IP of your name server. (You can do ifconfig \/all to find out what they are)<\/p>\n<p>You need to also remove the dhcp client for this to stick (thanks to Peter for noticing). You might need to remove dhcp-client3 instead.<\/p>\n<p><em>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0sudo apt-get remove dhcp-client<\/em><\/p>\n<p style=\"display: inline !important;\"><em id=\"__mceDel\">\u00a0<\/em><\/p>\n<p>Now we\u2019ll just need to restart the networking components:<\/p>\n<blockquote><p>sudo \/etc\/init.d\/networking restart<\/p><\/blockquote>\n<p>Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).<\/p>\n<p>Article from\u00a0<a title=\"Change Ubuntu Server From DHCP to a Static IP Address\" href=\"http:\/\/www.howtogeek.com\/howto\/ubuntu\/change-ubuntu-server-from-dhcp-to-a-static-ip-address\/\" target=\"_blank\">HowToGeeks<\/a><\/p>\n<p>Hukural<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu Server after installation has set your server to use DHCP. you will need to change to a static IP address so that people can actually use it. How to you change without using GUI. 1.Changing this setting without a &hellip; <a href=\"https:\/\/wp.eejin.org\/?p=55\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/wp.eejin.org\/index.php?rest_route=\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.eejin.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.eejin.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.eejin.org\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.eejin.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=55"}],"version-history":[{"count":1,"href":"https:\/\/wp.eejin.org\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":56,"href":"https:\/\/wp.eejin.org\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions\/56"}],"wp:attachment":[{"href":"https:\/\/wp.eejin.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.eejin.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.eejin.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}