• FL2440 rt3070模块station模式动态获取IP地址


    ------------------------------------------------------------------------------------------------------------------------------

    交叉编译器:arm-linux-gcc-4.5.4

    Linux内核版本:Linux-3.0

    开发板:FL2440

    本文章的内核已经已经添加了DM9000的网卡,USB驱动,使用的是initramfs的文件系统。

    ------------------------------------------------------------------------------------------------------------------------------

    一、配置内核

    [*] Networking support --->
    Networking options --->
    <*> Packet socket
    <*> Unix domain sockets
    [*] TCP/IP networking
    [*] IP: kernel level autoconfiguration
    [*] IP: DHCP support
    [*] Network packet filtering framework (Netfilter) --->

    二、配置busybox

    [*]udhcp server(udhcpd)

    [*]udhcp client(udhcpc)  都选上  udhcpd就是终端设备作为DHCP服务器 ;udhcpc就是终端设备作为DHCP客户端

    Networking Utilities --->
       [*] udhcp client for DHCPv6 (udhcpc6)                                            

       [*] udhcp server (udhcpd)  //生成udhcpc命令 

    sudo make install

    从Busybox的examples/udhcp/下拷贝simple.script文件到开发板的/usr/share/udhcpc/下,并重命名为default.script,然后更改文件default.script的权限为可执行文件。

    三、测试

    >: mv simple.script default.script
    >: chmod a+x default.script
    >: mkdir -p /usr/share/udhcpc
    >: cp default.script /usr/share/udhcpc/
    >: ping 192.168.199.1
    PING 192.168.199.1 (192.168.199.1): 56 data bytes
    64 bytes from 192.168.199.1: seq=0 ttl=64 time=50.549 ms
    64 bytes from 192.168.199.1: seq=1 ttl=64 time=47.244 ms

    --- 192.168.199.1 ping statistics ---
    2 packets transmitted, 2 packets received, 0% packet loss
    round-trip min/avg/max = 47.244/48.896/50.549 ms
    >: udhcpc -i wlan0
    udhcpc (v1.20.2) started
    Setting IP address 0.0.0.0 on wlan0
    Sending discover...
    Sending select for 192.168.199.181...
    Lease of 192.168.199.181 obtained, lease time 43200
    Setting IP address 192.168.199.181 on wlan0
    Deleting routers
    route: SIOCDELRT: No such process
    Adding router 192.168.199.1
    Recreating /etc/resolv.conf
    Adding DNS server 192.168.199.1
    >: ifconfig
    eth0 Link encap:Ethernet HWaddr D6:10:9A:CD:CD:91
        inet addr:192.168.1.111 Bcast:192.168.1.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:248 errors:0 dropped:0 overruns:0 frame:0
        TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:23616 (23.0 KiB) TX bytes:786 (786.0 B)
        Interrupt:51 Base address:0x4300

    wlan0 Link encap:Ethernet HWaddr 00:A1:B0:40:6F:9A
        inet addr:192.168.199.181 Bcast:192.168.199.255 Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:1635 errors:0 dropped:431 overruns:0 frame:0
        TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:150647 (147.1 KiB) TX bytes:4231 (4.1 KiB)

    >: route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    default Hiwifi.lan 0.0.0.0 UG 0 0 0 wlan0
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
    192.168.199.0 * 255.255.255.0 U 0 0 0 wlan0

  • 相关阅读:
    JobTracker作业启动过程分析
    结构体传参
    getchar()
    char *a与char a[n]的区别
    EOF NULL 之间的区别
    现代方法第15章第三节的程序
    交换机console口连接
    undefined reference问题总结
    二维数组与指针
    数组作为参数传递的时候,被调用的函数内无法计算出数组的大小
  • 原文地址:https://www.cnblogs.com/xiaohexiansheng/p/5674287.html
Copyright © 2020-2023  润新知