User Tools

Site Tools


changeubuntuserverfromdhcptoastaticipaddress

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
changeubuntuserverfromdhcptoastaticipaddress [2013/01/28 04:29] – external edit 127.0.0.1changeubuntuserverfromdhcptoastaticipaddress [2013/07/05 19:06] deftesprit
Line 1: Line 1:
 ====== Change Ubuntu Server from DHCP to a Static IP Address ====== ====== Change Ubuntu Server from DHCP to a Static IP Address ======
-<p>If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.</p> +If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.
-<p>Changing this setting without a GUI will require some text editing, but that's classic linux, right?</p> +
-<p>Let's open up the /etc/network/interfaces file. I'm going to use nano, but you can choose a different editor</p>+
  
-<blockquote><p>sudo nano /etc/network/interfaces</p> +Changing this setting without a GUI will require some text editing, but that's classic linux, right? 
-</blockquote> + 
-<p>For the primary interface, which is usually eth0, you will see these lines:</p> +Let's open up the /etc/network/interfaces file. I'm going to use nano, but you can choose a different editor. 
-<blockquote><p>auto eth0 + 
-iface eth0 inet dhcp</p>+<blockquote>sudo nano /etc/network/interfaces</blockquote> 
 +For the primary interface, which is usually eth0, you will see these lines: 
 +<blockquote>auto eth0 
 +iface eth0 inet dhcp
 </blockquote> </blockquote>
-<p>As you can see, it's using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should be added below it. Obviously you'd customize this to your network.</p> +As you can see, it's using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should be added below it. Obviously you'd customize this to your network. 
-<blockquote><p>auto eth0+<blockquote>auto eth0
 iface eth0 inet static iface eth0 inet static
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address 192.168.1.100 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address 192.168.1.100
Line 17: Line 18:
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; network 192.168.1.0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; network 192.168.1.0
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; broadcast 192.168.1.255 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; broadcast 192.168.1.255
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gateway 192.168.1.1</p>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gateway 192.168.1.1
  
 </blockquote> </blockquote>
-<p> + 
-Now we'll need to add in the DNS settings by editing the resolv.conf file:</p> +Now we'll need to add in the DNS settings by editing the resolv.conf file: 
-<blockquote><p>sudo nano /etc/resolv.conf</p></blockquote> +<blockquote>sudo nano /etc/resolv.conf</blockquote> 
-<p>On the line 'nameserver xxx.xxx.xxx.xxx' replace the x with the IP of your name server. (You can do ifconfig /all to find out what they are) </p> +On the line 'nameserver xxx.xxx.xxx.xxx' replace the x with the IP of your name server. (You can do ifconfig /all to find out what they are)  
-<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> + 
-<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>+
 <blockquote> <blockquote>
 sudo apt-get remove dhcp-client<br /> sudo apt-get remove dhcp-client<br />
Line 32: Line 33:
 sudo apt-get remove isc-dhcp-client sudo apt-get remove isc-dhcp-client
 </blockquote> </blockquote>
-<p>Now we'll just need to restart the networking components:</p> +Now we'll just need to restart the networking components: 
-<blockquote><p>sudo /etc/init.d/networking restart</p>+<blockquote>sudo /etc/init.d/networking restart
  
 </blockquote> </blockquote>
-<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>+Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).
  
 ===== Promiscuous Mode ===== ===== Promiscuous Mode =====
changeubuntuserverfromdhcptoastaticipaddress.txt · Last modified: 2013/07/05 19:07 by deftesprit