ติดตั้ง LAN Card 2 แผง บน Ubuntu 14.04.1

network
network

9 ตุลาคม 2557 อยากทราบว่าในเครื่องมี LAN Card ติดตั้งไว้กี่แผง

ถ้าใช้คำสั่ง $lspci

พบ Ethernet controller : D-Link System Inc DGE-528T Gigabit Ethernet Adapter (rev06)

กับ Ethernet controller : Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

และมีรายละเอียดอื่น ๆ เช่น Host bridge, PCI bridge, ISA bridge, การ์ดเสียง หรือ อุปกรณ์ยูเอสบี เป็นต้น

ถ้าใช้คำสั่ง $lshw -businfo -C network

จะแสดง Device มา 2 รายการคือ p2p1 และ p2p2 อยู่ใต้ class ชื่อ network

คือ DGE-528T Gigabit Ethernet Adapter

กับ RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller

ถ้าใช้คำสั่ง $lshw -C network

จะมีรายละเอียดครบ รวมทั้งเลขของ mac address

จึงทราบว่า D-Link System Inc มี mac address คือ d8:fe:e3:a7:34:0a

และ Realtek Semiconductor Co., Ltd. มี mac address คือ e0:3f:49:ac:f3:92

ถ้าใช้คำสั่ง $ifconfig –a

จะพบว่ามี p2p1 และ p2p2 เปิดให้บริการพร้อมกับเลข mac address
เป็นคำสั่งที่นิยมใช้ในการตรวจสอบ network interfaces

มี LAN Card 2 แผง จะกำหนด IP Address อย่างไรดี

คิดว่าวงที่ออกอินเทอร์เน็ตจะให้ออกไปทาง 192.168.2.1

โดยเครื่องนี้มี IP คือ 192.168.2.5 โดย mac address คือ d8:fe:e3:a7:34:0a

แล้วสร้างเครือข่ายวงในอีก 1 วงผ่าน LAN Card แผงที่สอง

กำหนด IP เป็น 10.10.10.5  โดย mac address คือ e0:3f:49:ac:f3:92

วางแผลแล้วก็เข้าแก้ไขแฟ้ม interfaces ดังนี้

$sudo nano /etc/network/interfaces

auto p2p1

iface p2p1 inet static

address 192.168.2.5

netmask 255.255.255.0

up route add default gw 192.168.2.1 dev p2p1

hwaddress ether d8:fe:e3:a7:34:0a

dns-nameservers 8.8.8.8 8.8.4.4

auto p2p2

iface p2p2 inet static

address 10.10.10.5

netmask 255.255.255.0

hwaddress ether e0:3f:49:ac:f3:92

สั่งปิดเครื่องหรือ restart เครื่องใหม่

$sudo shutdown -r now

$sudo shutdown -h now

ตรวจสอบว่าเวลาออกเน็ตจะออกไปทางการ์ดแลนแผงใด

เมื่อใช้คำสั่ง $route

ให้ดูที่ค่า default ว่าจะไปหา gateway เบอร์ใด

Destination Gateway

default 192.168.2.1

10.10.10.0 *

192.168.2.0 *

Author: บุรินทร์ รุจจนพันธุ์

I am Lecturer, Developer, Researcher, Columnist, Writer, Photographer, and Webmaster - L@mpang man

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.