Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> สมาร์ทโฟน >> Linux

Tethering อินเทอร์เน็ต Nokia N95 ไปยัง Laptop ผ่าน USB บน Linux

หมายเหตุ: บทความปี 2008 อ้างอิงซอฟต์แวร์เก่า (Fedora 9, wvdial, GNOME 2) แต่หลักการยังใช้ได้กับ Distro สมัยใหม่ด้วย NetworkManager/ModemManager

⚠ คำเตือน: ใช้ข้อมูล 3G อาจมีค่าใช้จ่ายสูงมาก ตรวจสอบ Data Plan ก่อนใช้!

วิธี Command Line (wvdial)

  1. ติดตั้งแพ็กเกจ: sudo dnf install ppp wvdial (Fedora) / sudo apt install ppp wvdial (Ubuntu/Debian)
  2. เสียบ USB → เลือกโหมด PC Suite บน N95
  3. ตรวจสอบอุปกรณ์: dmesg | grep ttyACM → ควรเจอ /dev/ttyACM0
  4. แก้ไข /etc/wvdial.conf:
    [Dialer Defaults]
    Modem = /dev/ttyACM0
    Baud = 460800
    Init1 = ATZ
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Init3 = ATM0
    FlowControl = CRTSCTS
    Carrier Check = no
    Stupid Mode = yes
    
    [Dialer USB]
    Username = user
    Password = pass
    Phone = *99***1#
    Inherits = Dialer Defaults

    Username/Password/Phone ขึ้นอยู่กับ ISP (โทรสอบถาม)

  5. สร้าง /etc/ppp/ip-up.local สำหรับ DNS อัตโนมัติ:
    #!/bin/bash
    echo "# created by pppd" > /etc/resolv.conf
    echo "nameserver ${DNS1}" >> /etc/resolv.conf
    echo "nameserver ${DNS2}" >> /etc/resolv.conf
    chmod 644 /etc/resolv.conf
    chmod 755 /etc/ppp/ip-up.local
  6. เชื่อมต่อ (ต้อง root): sudo wvdial USB
  7. ทดสอบ: ping 8.8.8.8 หรือเปิดเว็บ
  8. ตัดการเชื่อมต่อ: กด Ctrl+C ที่ Terminal wvdial

วิธี GUI (NetworkManager - แนะนำสมัยใหม่)

  1. คลิกไอคอน Network Panel → Edit Connections
  2. + → Mobile Broadband → Create
  3. เลือกอุปกรณ์ (Modem) → Continue
  4. เลือกประเทศ/ISP → ใส่ APN/Username/Password ตาม ISP
  5. ตั้งชื่อ Connection (เช่น N95-USB) → Save
  6. คลิกไอคอน Network → เลือก Connection ที่สร้าง → เชื่อมต่ออัตโนมัติ

แก้ปัญหาเบื้องต้น

  • ไม่เจอ /dev/ttyACM0: ตรวจสอบ ls /dev/ttyACM* และ dmesg -T | grep -i usb
  • Permission denied: เพิ่ม user เข้า group dialout: sudo usermod -aG dialout $USER (Relogin)
  • DNS ไม่ทำงาน: ตรวจสอบ /etc/resolv.conf และ ip-up.local
  • ใช้ NetworkManager แทน wvdial (ง่ายกว่า รองรับ UI ทั้ง GNOME/KDE)

ปัจจุบัน: ใช้ NetworkManager (nmcli/nmtui/GUI) เป็นหลัก wvdial เหมาะสำหรับ Server ไม่มี GUI หรือ Debug ปัญหา Modem