OpenWrt 4G網絡卡撥號配置
基礎知識
MiniPCI-e, 介面其實就是USB介面, 採用的USB協議.
USB協議中有product id, vendor id.
4G網絡卡的撥號方式有三種:
PPP (PPP over EV-DO, CDMA, UMTS or GPRS)
QMI (USB modems using QMI protocol)
NCM (USB modems using NCM protocol)
配置USB驅動
檢測方法是lsusb, 可以看到這個.
將USB的驅動中加入驅動中.
drivers/usb/serial/option.c static const struct usb_device_id option_ids[] = { { USB_DEVICE(0x161c, 0x9115) },
串列埠相關配置:
1、USB 串列埠驅動相關的配置項:
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USB_SERIAL_WWAN=ymake kernel_menuconfig
Device Drivers —>
USB support —>
USB Serial Converter support —> (預設是M,且不能設為*)習慣上=y 使得編譯進核心而不是作為模組,那麼得配置好一些USB相關
<> Support for Host-side USB (預設M,選擇方便USB Serial可以=y)
<*> USB announce new devices
[*] Enable USB persist by default
<*> EHCI HCD(USB 2.0) support
[*] Root Hub Transaction Translators
[*] Improved Transaction Translator scheduling
<*> OHCI HCD support
<*> USB Modem (CDC ACM) support
<*> USB Printer support
<*> USB Wireless Device Management supportUSB Serial Converter support —>
<*> USB driver for GSM and CDMA modems退出後儲存,git status檢視會修改target/linux/ramips/mt7620n/config-3.10 這裡便是核心的預設編譯配置檔案
2、PPP 撥號的相關配置項:
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=ymake kernel_menuconfig
Device Drivers —>
[*] Network device support —>
<*> PPP (point-to-point protocol) support
<*> PPP BSD-Compress compression
<*> PPP Deflate compression
[*] PPP filtering
[*] PPP multilink support
<*> PPP MPPE compression (encryption)
[*] PPP multilink support
<*> PPP over Ethernet
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
- 配置工具PPP需要
Utilities —>
<*> comgt
四、新增ppp0網路節點
target/linux/ramips/base-files/etc/uci-defaults/02_network
+ m201)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_set_interfaces_3g "ppp0"
+ ;;
+
ur-336un)
package/base-files/files/lib/functions/uci-defaults.sh
+ucidef_set_interface_ppp0() {
+ local ifname=$1
+
+ uci batch <<EOF
+set network.ppp0='interface'
+set network.ppp0.ifname='$ifname'
+set network.ppp0.proto='3g'
+set network.ppp0.apn='3gnet'
+set network.ppp0.service='umts'
+set network.ppp0.dialnumber='*99#'
+set network.ppp0.device='/dev/ttyUSB0'
+EOF
+}
+ucidef_set_interfaces_3g() {
+ local ppp0_ifname=$1
+
+ ucidef_set_interface_ppp0 "$ppp0_ifname"
+}
+
package/network/config/firewall/files/firewall.config
config zone
+ option network 'wan ppp0'
除錯的時候可以手動設定(我這裡是華為MU709s-2 WCDMA 聯通3G):
進入etc/config/修改network,增加一個3G 網路節點
config interface 'ppp0'
option ifname 'ppp0'
option proto '3g'
option apn '3gnet'
option service 'umts'
option dialnumber '*99#'
option device '/dev/ttyUSB0'
注:聯通apn:3gnet 電信apn:ctnet 移動apn:cmnet/cmwap
聯通dialnumber:3G為*99# 電信:3G為#777 移動為:*99***1# LTE為:*99#