|
OpenWRT 4G网卡自动拔号配置方法
查看是否驱动成功(驱动移植是收费服务有需求可以联系)
添加端口wwan0
- config interface 'loopback'
- option ifname 'lo'
- option proto 'static'
- option ipaddr '127.0.0.1'
- option netmask '255.0.0.0'
- config globals 'globals'
- option ula_prefix 'fd59:a22b:2bea::/48'
- config interface 'lan'
- option type 'bridge'
- option _orig_ifname 'eth0.1 ra0'
- option _orig_bridge 'true'
- option proto 'dhcp'
- option ifname 'eth0.1 ra0'
- option hostname 'gateway'
- config switch
- option name 'switch0'
- option reset '1'
- option enable_vlan '1'
- config switch_vlan
- option device 'switch0'
- option vlan '1'
- option ports '0 1 2 3 6t'
- config switch_vlan
- option device 'switch0'
- option vlan '2'
- option ports '4 6t'
- config interface 'wwan'
- option proto 'dhcp'
- option ifname 'wwan0'
复制代码
重启网关
4G网卡
拨号命令
- uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect
复制代码
拨号查询命令
uqmi -d /dev/cdc-wdm0 --get-data-status
- root@TJ:/# uqmi -d /dev/cdc-wdm0 --get-data-status
- "connected"
复制代码 拔号成功
查看网络连接情况
- fconfig
- .....
- wwan0 Link encap:Ethernet HWaddr C2:28:EB:4D:61:C8
- inet addr:10.7.104.115 Bcast:10.7.104.119 Mask:255.255.255.248
- inet6 addr: fe80::c028:ebff:fe4d:61c8/64 Scope:Link
- UP BROADCAST RUNNING NOARP MULTICAST MTU:1500 Metric:1
- RX packets:68 errors:0 dropped:0 overruns:0 frame:0
- TX packets:482 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:10735 (10.4 KiB) TX bytes:125275 (122.3 KiB)
复制代码
开机自动 4G 拨号上网
exit0 前添加
- sleep 5
- uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect &
复制代码
整个内容:
- # Put your custom commands here that should be executed once
- # the system init finished. By default this file does nothing.
- /root/watch&
- sleep 5
- uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect &
- exit 0
复制代码 重启网关
再次查看网络连接情况
- fconfig
- .....
- wwan0 Link encap:Ethernet HWaddr C2:28:EB:4D:61:C8
- inet addr:10.7.104.115 Bcast:10.7.104.119 Mask:255.255.255.248
- inet6 addr: fe80::c028:ebff:fe4d:61c8/64 Scope:Link
- UP BROADCAST RUNNING NOARP MULTICAST MTU:1500 Metric:1
- RX packets:68 errors:0 dropped:0 overruns:0 frame:0
- TX packets:482 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:10735 (10.4 KiB) TX bytes:125275 (122.3 KiB)
复制代码
设置一切OK
|
+10
|