How to configure static IP on CentOS and Debian + a bit of network utils

This is only for reference.

Debian

This is a copy/paste from my Gist for Debian 5+ static IP configuration, separated:

Ethernet interface

# eth0
$ vim /etc/network/interfaces

# Auto generated lo interface
auto lo
iface lo inet loopback

# Static ip
iface eth0 inet static
     address [ipaddress] (10.0.0.50)
     network [ipaddress] (10.0.0.0)
     netmask 255.255.255.0
     broadcast [ipaddress] (10.0.0.255)
     gateway [ipaddress] (10.0.0.1)

Resolv.conf

# Local DNS 
$ vim /etc/resolv.conf

# Google DNS
nameserver 8.8.8.8

# Fallback at OpenDNS
nameserver 208.67.222.222
nameserver 208.67.220.220

Restart network

# Restart network
$ sudo service networking restart

CentOS

This is a copy/paste from my Gist for CentOS 5+ static IP configuration, separated:

Ethernet interface

# eth0
$ vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
NAME="eth0"
IPADDR=[ipaddress]
NETMASK=255.255.255.0

Gateway

# Gateway
$ vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=aarvik
GATEWAY=[ipaddress]

Resolv.conf

# Local DNS 
$ vim /etc/resolv.conf

# Google DNS
nameserver 8.8.8.8

# Fallback at OpenDNS
nameserver 208.67.222.222
nameserver 208.67.220.220

Restart network

# Restart network
$ sudo service network restart

Debug

For network debugging i would like to recommend these tools:

route - for routing and firewall
ifconfig - for network interfaces
ethtool - for network driver/settings
ping - for connectivity
telnet - for TCP connectivity
nc - for TCP/IP tricks (nc - TCP/IP swiss army knife)
dig - for DNS
netstat - for various network connection and routing records
arp - for IP to MAC resolution
tshark - for network protocol analyzing
tcpdump - for TCP packets dump
iptables - for local Linux firewall