谷动谷力

标题: OpenWRT EC20 4G网卡自动拔号配置方法  [打印本页]

作者: 鸣涧    时间: 2022-3-14 17:36
标题: OpenWRT EC20 4G网卡自动拔号配置方法 
OpenWRT 4G网卡自动拔号配置方法 

查看是否驱动成功(驱动移植是收费服务有需求可以联系)
  1. ls /dev
复制代码




添加端口wwan0
  1. vim /etc/config/network
复制代码

  1. config interface 'loopback'
  2.         option ifname 'lo'
  3.         option proto 'static'
  4.         option ipaddr '127.0.0.1'
  5.         option netmask '255.0.0.0'

  6. config globals 'globals'
  7.         option ula_prefix 'fd59:a22b:2bea::/48'

  8. config interface 'lan'
  9.         option type 'bridge'
  10.         option _orig_ifname 'eth0.1 ra0'
  11.         option _orig_bridge 'true'
  12.         option proto 'dhcp'
  13.         option ifname 'eth0.1 ra0'
  14.         option hostname 'gateway'

  15. config switch
  16.         option name 'switch0'
  17.         option reset '1'
  18.         option enable_vlan '1'

  19. config switch_vlan
  20.         option device 'switch0'
  21.         option vlan '1'
  22.         option ports '0 1 2 3 6t'

  23. config switch_vlan
  24.         option device 'switch0'
  25.         option vlan '2'
  26.         option ports '4 6t'

  27. config interface 'wwan'
  28.         option proto 'dhcp'
  29.         option ifname 'wwan0'
复制代码


重启网关

  1. reboot
复制代码

4G网卡

拨号命令
  1. uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect
复制代码

拨号查询命令
uqmi -d /dev/cdc-wdm0 --get-data-status

  1. root@TJ:/# uqmi -d /dev/cdc-wdm0 --get-data-status
  2. "connected"
复制代码
拔号成功

查看网络连接情况
  1. fconfig
  2. .....
  3. wwan0     Link encap:Ethernet  HWaddr C2:28:EB:4D:61:C8  
  4.           inet addr:10.7.104.115  Bcast:10.7.104.119  Mask:255.255.255.248
  5.           inet6 addr: fe80::c028:ebff:fe4d:61c8/64 Scope:Link
  6.           UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
  7.           RX packets:68 errors:0 dropped:0 overruns:0 frame:0
  8.           TX packets:482 errors:0 dropped:0 overruns:0 carrier:0
  9.           collisions:0 txqueuelen:1000
  10.           RX bytes:10735 (10.4 KiB)  TX bytes:125275 (122.3 KiB)
复制代码



开机自动 4G 拨号上网

  1. vim /etc/rc.local
复制代码

exit0 前添加
  1. sleep 5
  2. uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect &
复制代码

整个内容:
  1. # Put your custom commands here that should be executed once
  2. # the system init finished. By default this file does nothing.
  3. /root/watch&
  4. sleep 5
  5. uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect &
  6. exit 0
复制代码
重启网关

  1. reboot
复制代码

再次查看网络连接情况
  1. fconfig
  2. .....
  3. wwan0     Link encap:Ethernet  HWaddr C2:28:EB:4D:61:C8  
  4.           inet addr:10.7.104.115  Bcast:10.7.104.119  Mask:255.255.255.248
  5.           inet6 addr: fe80::c028:ebff:fe4d:61c8/64 Scope:Link
  6.           UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
  7.           RX packets:68 errors:0 dropped:0 overruns:0 frame:0
  8.           TX packets:482 errors:0 dropped:0 overruns:0 carrier:0
  9.           collisions:0 txqueuelen:1000
  10.           RX bytes:10735 (10.4 KiB)  TX bytes:125275 (122.3 KiB)
复制代码

设置一切OK





欢迎光临 谷动谷力 (http://bbs.sunsili.com/) Powered by Discuz! X3.2