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.
Changing this setting without a GUI will require some text editing, but that’s classic linux, right?
Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor
sudo vi /etc/network/interfaces
For the primary interface, which is usually eth0, you will see these lines:
auto eth0
iface eth0 inet dhcp
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.
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Now we’ll need to add in the DNS settings by editing the resolv.conf file:
sudo vi /etc/resolv.conf
On the line ‘name server 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)
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.
sudo apt-get remove dhcp-client
Now we’ll just need to restart the networking components:
sudo /etc/init.d/networking restart
Ping www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).
Really pretty simple.
How to Change Ubuntu Server from DHCP to a Static IP Address
Related Posts:
How to Copy & Paste in TerminalThere are two terminals in Ubuntu: the one you invoke with (Alt+F2) "xterm" and the one you invoke with (Alt+F2) "gnome-terminal". The gnome-terminal… Read More
Howto Record Video Using VLC in Ubuntu / Debian VLC can also used for recording videos during Playback. But, By default the record button is hidden in VLC. First you have to enable the Record Butt… Read More
Speed up Ubuntu Linux - Fine tuning UbuntuSpeed launch your Ubuntu using the following steps Stop unnecessary Applications and Services that start automatically at boot time. First Stop the… Read More
Play Sony Handicam files ( .m2ts ) in Ubuntu Linux MT2S files are generally used with Sony formats and hardware, particularly Blu-ray Disc and AVCHD. Camcorders make use of M2TS in the form of AVCHD, … Read More
how to Root login in Ubuntu 10.04Ubuntu root access was blocked by default for GUI. For Enabling This you need to reset password for root. once password for root is reset. You can lo… Read More
0 comments:
Post a Comment