Skip to content

Configuring a Local Network on Debian and Ubuntu

Introduction

Not always easy to remember what to put in these damn files, right? Here are some simple examples.

Configuring Network Interfaces

Edit the file /etc/network/interfaces.

Static IP Addressing

For example, here's how I configure my eth0 interface:

auto lo eth0
iface lo inet loopback

# Interface eth0
iface eth0 inet static
       address 192.168.0.1
       netmask 255.255.255.0
       broadcast 192.168.0.255
       network 192.168.0.0
       gateway 192.168.0.138

Dynamic IP Addressing

If I want dynamic addressing, it's even simpler:

1
2
3
4
5
auto lo eth0
iface lo inet loopback

# Interface eth0 
iface eth0 inet dhcp

Configuring DNS Servers

Edit the file /etc/resolv.conf:

1
2
3
4
5
search deimos.fr local
nameserver 192.168.0.1
nameserver 192.168.0.2
nameserver 212.27.32.5
nameserver 212.27.32.6