千家信息网

嵌入式linux下MF825C上网

发表于:2024-11-21 作者:千家信息网编辑
千家信息网最后更新 2024年11月21日,中兴MF825C电信版插上usb网卡后#lsusb19d2:1225 (bus 1, device 3)0000:0000 (bus 1, device 1)网卡会自动模式转换#lsusb19d2:1
千家信息网最后更新 2024年11月21日嵌入式linux下MF825C上网

中兴MF825C电信版

插上usb网卡后

#lsusb

19d2:1225 (bus 1, device 3)

0000:0000 (bus 1, device 1)

网卡会自动模式转换

#lsusb

19d2:1405 (bus 1, device 3)

0000:0000 (bus 1, device 1)

在内核上选择支持它的驱动模块

确保这三个模块都有rndis_host.ko,cdc_ether.ko,usbnet.ko然后添加驱动

#modprobe rndis_host

会根据依赖关系挂载相应的模块

rndis_host 6048 0

cdc_ether 4992 1 rndis_host

usbnet 14160 2 rndis_host,cdc_ether

#ifconfig -a

usb0 Link encap:Ethernet HWaddr 36:4B:50:B7:EF:61

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:4923 errors:0 dropped:0 overruns:0 frame:0

TX packets:6229 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:1287334 (1.2 MiB) TX bytes:1315840 (1.2 MiB)

如果驱动没问题就会看到usb0的虚拟网卡

#ifconfig usb0 up

#udhcpc -i usb0 -s /sbin/udhcpc.sh -p /var/run/udhcpc.pid

udhcpc (v1.12.1) started

Sending select for 192.168.0.133...

Lease of 192.168.0.133 obtained, lease time 86400

deleting routers

route: ioctl 0x890c failed: No such process

adding dns 192.168.0.1

igmpproxy, Version 0.1 beta2, Build 160601

Copyright 2005 by Johnny Egeland

#ifconfig usb0

usb0 Link encap:Ethernet HWaddr 36:4B:50:B7:EF:61

inet addr:192.168.0.133 Bcast:192.168.0.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:24 errors:0 dropped:0 overruns:0 frame:0

TX packets:27 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4726 (4.6 KiB) TX bytes:5766 (5.6 KiB)

#ping www.baidu.com

PING www.baidu.com (220.181.112.244): 56 data bytes

64 bytes from 220.181.112.244: seq=0 ttl=52 time=57.345 ms

64 bytes from 220.181.112.244: seq=1 ttl=52 time=53.074 ms

64 bytes from 220.181.112.244: seq=2 ttl=52 time=49.176 ms

到此OK。

0