[Ubuntu]eth0のIPアドレス変更

Ubunto8.0.4サーバーの初期設定ではeth0はDHCPになっているのでこれを修正する。

対象ファイル
/etc/network/interfaces

初期設定

 # The loopback network interface
 auto lo
 iface lo inet loopback
 # The primary network interface
 auto eth0
 iface eth0 inet dhcp

下半分がeth0の設定なのでそこを書き換える。

 #iface eth0 inet dhcp
 iface eth0 inet static
 address 192.168.0.X1
 netmask 255.255.255.0
 gateway 192.168.0.X2

こんな感じ。#man interfacesで詳しいヘルプを見ることもできる。