Etiquetado: Networking

Configurar red estática en Ubuntu Server 14.04 LTS

En Ubuntu viene por defecto el DHCP activado, a continuación os explicaré como configurar una IP estática.

ubuntu-14_04

Lo primero es abrir el documento de interfaces:

$ sudo nano /etc/network/interfaces

Dentro nos encontramos que esta configurado como DHCP, lo editaremos con la IP estática y la configuración que queramos:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0

# DHCP not needed
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.10.15
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
dns-nameservers 8.8.8.8 8.8.4.4

Guardarmos y ahora iremos a editar resolv.conf:

$ sudo nano /etc/resolv.conf

Le añadimos:

nameserver 8.8.8.8
nameserver 8.8.4.4
search midominio.local

Lo siguiente es añadir la IP fija al archivo hosts:

$ sudo nano /etc/hosts

Y le añadimos:

192.168.10.15   vmtest01.midominio.local  vmtest01

Reiniciamos la tarjeta de red:

$ sudo ifdown eth0 && sudo ifup eth0

Lo hacemos de esa forma ya que el Ubuntu 14.04 tiene un bug, no  funciona correctamente el servicio networking, para solucionarlo debemos  hacer lo siguiente:

$ sudo apt-get install git
$ sudo git clone https://github.com/metral/restore_networking.git
$ cd restore_networking/
$ sudo ./restore_networking.sh

$ sudo service networking restart
networking stop/waiting
networking start/running