ผู้เขียน หัวข้อ: ubuntu server 8.04 : setup lan card static ip  (อ่าน 2576 ครั้ง)    

winzeny

  • Administrator
  • Newbie
  • *****
  • กระทู้: 39
    • ดูรายละเอียด
ubuntu server 8.04 : setup lan card static ip
« เมื่อ: มีนาคม 15, 2010, 09:48:28 PM »
ตัวอย่างต่อไปนี้จะเป็นการ set lan card ให้เป็นแบบ static (fix ip) ดังนี้

ip : 192.168.50.200

mask : 255.255.255.0

gateway : 192.168.50.201

โดยทำการแก้ไข file : /etc/network/interfaces

เบื้องต้นให้ทำการเปลี่ยนสิทธิเป็น root ด้วย su root (ดูเพิ่มเติมหน้า http://www.compware-agency.com/forum/index.php?topic=16.0)

root@hotspot:/home/rawin# ifconfig <---- เพื่อดูรายละเอียด lan card ที่ใช้งาน

eth0 Link encap:Ethernet HWaddr 00:03:ff:d0:01:e8
inet addr:192.168.50.192 Bcast:192.168.50.255 Mask:255.255.255 .0
inet6 addr: fe80::203:ffff:fed0:1e8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:403396 errors:0 dropped:0 overruns:0 frame:0
TX packets:5348 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33398850 (31.8 MB) TX bytes:597462 (583.4 KB)
Interrupt:11 Base address:0xec00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:444 errors:0 dropped:0 overruns:0 frame:0
TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22200 (21.6 KB) TX bytes:22200 (21.6 KB)

ในตัวอย่างจะมี lan card : eth0 ถูกติดตั้งอยู่

root@hotspot:/home/rawin# vim /etc/network/interfaces <----- vim command เพื่อแก้ไข ไฟล์ vim /etc/network/interfaces

กด i เพื่อทำการแก้ไข

# 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 eth0 <----- เพิ่ม interface eth0 เข้าไป
iface lo inet loopback

# The primary network interface
iface eth0 inet static <----- เปลี่ยนจาก dhcp เป็น static
address 192.168.50.200 <----- ip address
netmask 255.255.255.0 <----- netmask address
network 192.168.50.0 <------ network address
broadcast 192.168.50.255 <----- broadcast address
gateway 192.168.50.201 <------ gateway address

หลังจากแก้ไขเสร็จ กด Esc ---> กด : ---> พิมพ์ wq ---> enter

ขั้นตอนสุดท้ายทำการ restart network service ด้วยคำสั่ง /etc/init.d/networking restart
« แก้ไขครั้งสุดท้าย: มีนาคม 15, 2010, 09:53:25 PM โดย winzeny »


 

Google bot last visit powered by Gbotvisit.comGoogle PageRank Checker