openwrt路由器接华为E3372(E8372)网卡实现4G转有线和WIFI

http://www.yizu.org/archives/721/

华为经典的两款4G LTE网卡E3372、E8372,俗称卡托,小巧,性能在同类产品中比较不错。有的时候我们需要把4G信号转成有线或者wifi使用,那就可以把E3372(E8372)插在openwrt路由器上实现。E3372根据固件不同有两种模式实现,一种是版本号以21开头固件的NCM模式(拨号),一种是版本号以22开头固件的Hilink模式(Nat),e8372只有Hilink模式。下面分别介绍这两种模式的设置方法。

Hilink模式

在openwrt系统中安装

1
2
3
opkg install kmod-usb-dwc2
opkg install kmod-usb-net-huawei-cdc-ncm
opkg install kmod-usb-net-rndis kmod-usb-net kmod-usb2 usb-modeswitch kmod-usb-net-cdc-ether

安装完成后,把E3372(E8372)插入路由器USB口,待4G指示灯亮起,打开openwrt路由器wan口(没有就添加它)设置界面,你会发现物理设置接口多了一项以太网适配器: “eth2” ,eth后面的数字是在已有接口基础上增加的。那么它就是4G设备接口,就选中它并保存应用。wan口协议设置成DHCP客户端,这个时候你会发现wan已经能够获取到IP地址,只要防火墙设置正确就能上网了。
如果需要IPv6,再以相同的方法设置wan6,协议设置成DHCPv6客户端,这个时候就能获取到IPv6地址了,具体如何配置openwrt的IPv6,见《openwrt设置nat转发实现ipv6访问互联网》。

NCM模式

在openwrt系统中安装comgt comgt-ncm kmod-usb-net-cdc-ncm kmod-usb-net-huawei-cdc-ncm luci-proto-ncm kmod-usb2 usb-modeswitch kmod-usb-serial-wwan kmod-usb-serial kmod-usb-serial-option。注意luci-proto-ncm是NCM模式的设置界面,不安装它就无法web界面配置NCM拨号。
安装完这些软件,把支持NCM模式的E3372插入路由器USB口,添加接口LTE(名称随便),协议选择NCM,然后再如下图对该接口进行设置。这里是联通的拨号设置,移动和电信略有不同。

img

保存并应用设置后,过一会将看到网卡指示灯常亮,表明已经拨号成功,但是这个时候路由器本身已经可以上网,但是连接路由器的设备还无法联网。还要对wan口进行设置,没有的要添加这个接口。设置wan口协议为DHCP客户端,物理设置接口选择以太网适配器: “wwan0”,保存并应用,这个时候你会发现wan口已经获取到IP地址了,设置完成后如下图这样。这个时候只要防火墙设置正确,所有设备就可以上网了。

img

怎么样把Hilink模式的E3372改成NCM模式,请看《华为E3372无线网卡Hilink模式改Modem模式(刷机)》。

https://forum.openwrt.org/t/wwan-huawei-e8372/16564

1
opkg install kmod-usb-dwc2
1
2
3
这个可以不安装
opkg install kmod-usb-storage
cat /sys/kernel/debug/usb/devices

step 1:
I plugged the dongle in my PC and the web interface poppes up on 192.168.8.1
I filled in the necessary and made sure all worked and tested the dongle

step 2:
I installed the required packages on openWRT as found on the wiki 441

However there were a few that were not recognised and I installed them using the GUI (system-> software). Especially

1
kmod-usb-net-huawei-cdc-ncm

And I ended up with installing a whole lot more since it wasn’t working. You probably do not need everything

1
opkg install kmod-usb-net-rndis comgt-ncm kmod-usb-net-huawei-cdc-ncm kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch kmod-mii kmod-usb-net kmod-usb-wdm kmod-usb-net-qmi-wwan uqmi kmod-usb-net-cdc-mbim umbim

step 3
Then I saw using dmesg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 11.204447] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 11.223447] nf_conntrack version 0.5.0 (1957 buckets, 7828 max)
[ 11.300289] usbcore: registered new interface driver usbserial
[ 11.306389] usbcore: registered new interface driver usbserial_generic
[ 11.313160] usbserial: USB Serial support registered for generic
[ 11.383933] xt_time: kernel timezone is -0000
[ 11.396942] cdc_ether 1-1:1.0 eth1: register 'cdc_ether' at usb-ehci-platform -1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[ 11.408107] usbcore: registered new interface driver cdc_ether
[ 11.438857] usbcore: registered new interface driver cdc_ncm
[ 11.494377] usbcore: registered new interface driver huawei_cdc_ncm
[ 11.585831] PPP generic driver version 2.4.2
[ 11.603995] NET: Registered protocol family 24
[ 11.615131] usbcore: registered new interface driver qmi_wwan
[ 11.632972] usbcore: registered new interface driver rndis_host
[ 11.698801] usbcore: registered new interface driver cdc_mbim
[ 11.728944] usbcore: registered new interface driver option
[ 11.734760] usbserial: USB Serial support registered for GSM modem (1-port)
[ 11.787293] ath: EEPROM regdomain: 0x0

There was a new interface eth1.
Easy does it, and switched the default WAN from eth0.1 to eth1


openwrt路由器接华为E3372(E8372)网卡实现4G转有线和WIFI
http://blog.uanet.cn/NETWORK/openwrt路由器接华为E3372(E8372)网卡实现4G转有线和WIFI.html
作者
dnsnat
发布于
2025年2月13日
许可协议