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/interfacesFor the primary interface, which is usually eth0, you will see these lines:
auto eth0As 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.
iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.15.200sudo apt-get remove dhcp-client
netmask 255.0.0.0
broadcast 192.168.15.0
gateway 192.168.15.1
dns-nameservers 8.8.8.8
Now we’ll just need to restart the networking components:
sudo /etc/init.d/networking restartPing 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.
http://www.howtogeek.com/howto/ubuntu/change-ubuntu-server-from-dhcp-to-a-static-ip-address/
No hay comentarios:
Publicar un comentario