linux · raspberrypi · Server

Set static IP address on Ubuntu/Raspbian/Debian [Server environment]

IP Address

Debian (Jessie)

To assign a static IP you need to edit /etc/network/interfaces:

sudo nano /etc/network/interfaces

Comment/change “iface eth0 inet manual” line and add/change like this:

#iface eth0 inet manual
auto eth0
iface eth0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1

Reboot to apply the change:

reboot

Raspbian (Jessie)

To assign a static IP you need to edit /etc/network/interfaces:

sudo nano /etc/network/interfaces

Comment/change “iface eth0 inet manual” line and add/change like this:

#iface eth0 inet manual
auto eth0
iface eth0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1

Need to disable the DHCPcd service

sudo update-rc.d dhcpcd disable

Reboot to apply the change:

sudo reboot

Ubuntu Server 14.04 and 16.04

To assign a static IP you need to edit /etc/network/interfaces:

sudo nano /etc/network/interfaces

The current entry will look something like:

auto eth0
iface eth0 inet dhcp

Note: For the primary interface, which is usually “eth0” on Ubuntu 14.04, for Ubuntu 16.04

You will need you need to change and save this to:

auto eth0
iface eth0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1

Restart the networking and resolvconf service:

sudo service networking restart
sudo service resolvconf restart

Reboot if restart not work:

sudo reboot
Anúncios

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s