การตั้งค่า ip ใน ubuntu server

ใน ubuntu จะเก็บค่า ip เป็น text file
อยู่ที่ /etc/network/interdaces

ค่าเริ่มต้นที่อยู่ใน ไฟล์ จะเป็นดังนี้

# 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
iface eth0 inet dhcp

ต้องทำการแก้ไข ในส่วน The primary network interface ตามนี้

auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.255
gateway xxx.xxx.xxx.xxx

ตั้งแต่ ubuntu 12.04.3 ต้องเพิ่มคำสั่งต่อไปนี้ด้วย
dns-nameservers  xxx.xxx.xxx.xxx
dns-search lan

แต่ถ้าทุกอย่างถูกต้องแล้วไม่สามารถใช้งาน internet ไม่ได้
จะต้องดูใน
/etc/resolv.conf
เพิ่มเติมด้วย

xxx.xxx.xxx.xxx คงเข้าใจนะครับ ^.^