本帖最后由 tqwuping 于 2017-9-4 14:05 编辑
天嵌科技iMX6UL开发板平台的其中一个特点是支持双网卡:一机双网,可以使用内网外网于同一个板,直接上传数据。下面来讲解i.MX6UL工控板核心板网卡模块的测试方法,烧写使用tq-imx6ul_net0_net1.dtb 就是双网卡,这里只以eth0 为例子讲解。eth1 方法也一样。靠近耳机接口那一端子的是eth0,测试网卡模块时,接上网线,如果当前网卡是状态是down,网卡灯是不会亮的。在命令行输入操作如下:
- # udhcpc -i eth0
- udhcpc: started, v1.25.1
- fec 2188000.ethernet eth0: Freescale FEC PHY driver [Micrel KSZ8081 or KSZ8091]
- (mii_bus:phy_addr=2188000.ethernet:02, irq=-1)
- IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
- udhcpc: sending discover
- fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
- IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
- udhcpc: sending discover
- udhcpc: sending select for 192.168.1.236 #成功分配到ip
- udhcpc: lease of 192.168.1.236 obtained, lease time 7200
- deleting routers
- adding dns 202.96.128.166 #自动设置dns
- adding dns 202.96.134.133
- # ping www.qq.com
- PING www.qq.com (14.17.32.211) 56(84) bytes of data.
- 64 bytes from 14.17.32.211 (14.17.32.211): icmp_seq=1 ttl=55 time=5.34 ms
- 64 bytes from 14.17.32.211 (14.17.32.211): icmp_seq=2 ttl=55 time=5.12 ms
- 64 bytes from 14.17.32.211 (14.17.32.211): icmp_seq=3 ttl=55 time=7.80 ms
- 64 bytes from 14.17.32.211 (14.17.32.211): icmp_seq=4 ttl=55 time=5.41 ms
- ^C
- --- www.qq.com ping statistics ---
- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms
- rtt min/avg/max/mdev = 5.122/5.923/7.804/1.091 ms
如果一直循环打印一下信息说明网卡模块正常,测试完成后,在命令行按ctrl+c 键中断ping。
以上是测试外网的。如果不能连接外网。可以设置ip 后直接与pc 互ping。
- # ifconfig eth0 192.168.1.40 up #设置板子ip 要与电脑ip 为同网段
- fec 2188000.ethernet eth0: Freescale FEC PHY driver [Micrel KSZ8081 or KSZ8091]
- (mii_bus:phy_addr=2188000.ethernet:02, irq=-1)
- # ifconfig eth0 downfec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
- # ping -I eth0 192.168.1.49 #指定使用eth0 ping pc 的ip(192.168.1.49)
- PING 192.168.1.49 (192.168.1.49) from 192.168.1.40 eth0: 56(84) bytes of data.
- 64 bytes from 192.168.1.49: icmp_seq=1 ttl=64 time=0.625 ms
- 64 bytes from 192.168.1.49: icmp_seq=2 ttl=64 time=0.393 ms
- 64 bytes from 192.168.1.49: icmp_seq=3 ttl=64 time=0.378 ms
- 64 bytes from 192.168.1.49: icmp_seq=4 ttl=64 time=0.351 ms
- 64 bytes from 192.168.1.49: icmp_seq=5 ttl=64 time=0.374 ms
- ^C
- --- 192.168.1.49 ping statistics ---
- 5 packets transmitted, 5 received, 0% packet loss, time 3998ms
- rtt min/avg/max/mdev = 0.351/0.424/0.625/0.102 ms
- #
如果打印以下信息说明网络不通:
ping: bad address 'www.qq.com'
可能是ip 或者dns 没有设置对。
另外如果同时两个网口都接上网线时,两个网卡的ip 要设置成不同的网段。
原文:http://www.embedsky.com/index.php?g=home&m=news&a=show&id=36