免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2849 | 回复: 0
打印 上一主题 下一主题

802.1x协议在mini2440移植(wpa_supplicant移植) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-17 17:28 |只看该作者 |倒序浏览

                                               
       
       
       
       
       
       
-------------------------------------------------本文系本站原创,欢迎转载!
转载请注明出处:http://sjj0412.cublog.cn/
------------------------------------------------------------前天装ubuntu,照其他人方式用wpa_supplicant登录内网,搞了将近一下午都没搞成功,郁闷啊,最后偶然的机会用无线给搞定了。今天突然想到要将wpa_supplicant移植到开发板上,一则成功了的话,开发板就可以上网了,那多好,二则验证为什么我的ubuntu登录不了,于是上午看了802.1x的协议的一些东西,下午给移植成功了,过程如下移。
我们都知道在高一点版本的PC的Linux中,一般都带有wpa_supplicant,校内网一般用这个登录,今天就讲mini2440中的移植。
  • 下载wpa_supplicant
          下载后解压,
    1修改Makefile文件,将
    ifndef
    CC
    CC=gcc
    Endif
    改为arm-linux-gcc
    2再修改defconfig文件.
    由于我们学校的认证是用md5方式,将defconfig中除CONFIG_EAP_MD5=y外的其他CONFIG_EAP_xx去掉,因为,其他方式可能需要有相关的库,如tls就需要libtls.so库,为了编译方便,将用不到的尽量不要,免得编译时出错,事实上开始我没有修改进行编译时就出现了libtsl.so库中相关函数Undefine的错误,因为arm-linux库中不可能有这个库,所以会编译失败。
    #
    EAP-MD5
    CONFIG_EAP_MD5=y
    //[color="#ff0000"]只保留这个
    #
    EAP-MSCHAPv2
    CONFIG_EAP_MSCHAPV2=y
    #
    EAP-TLS
    CONFIG_EAP_TLS=y
    #
    EAL-PEAP
    CONFIG_EAP_PEAP=y
    #
    EAP-TTLS
    CONFIG_EAP_TTLS=y
    #
    EAP-GTC
    CONFIG_EAP_GTC=y
    #
    EAP-OTP
    CONFIG_EAP_OTP=y
    #
    EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
    #CONFIG_EAP_SIM=y
    #
    EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
    #CONFIG_EAP_PSK=y
    #
    EAP-PAX
    #CONFIG_EAP_PAX=y
    #
    LEAP
    CONFIG_EAP_LEAP=y
    #
    EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
    #CONFIG_EAP_AKA=y
    #
    EAP-SAKE
    #CONFIG_EAP_SAKE=y
    #
    EAP-GPSK
    #CONFIG_EAP_GPSK=y
    #
    Include support for optional SHA256 cipher suite in EAP-GPSK
    #CONFIG_EAP_GPSK_SHA256=y
    然后执make就ok了,然后就下到开发板运行。
    运行前要添加wpa_supplicant配置文件
    我的配置文件如下
    [root@FriendlyARM
    /]# cat /etc/lan.conf
    ctrl_interface=/var/run/wpa_supplicant
    #
    ctrl_interface_group=wheel
    ap_scan=0
    network={
            key_mgmt=IEEE8021X
            eap=MD5
          
    identity="028xxxxxx@local"//改为你自己的号,上外网去掉@local
            password="2475xxxx"
    //改为你自己的密码
            eapol_flags=0
    }
    [root@FriendlyARM
    /]# wpa_supplicant -B -ieth0 -c /etc/lan.conf -Dwired
    Ok了,
    但是这是认证,我们还要获得Ip等相关信息,所以要动刀dhcp软件,
    幸好mini2440带有udhcpc嵌入式动态ip客户端。
    所以我们执行
    [root@FriendlyARM
    /]#udhcpc eth0
    Sending
    select for 10.20.29.40...
    udhcpc[321]:
    Sending select for 10.20.29.40...
    Waiting
    on select...
    udhcpc[321]:
    Waiting on select...
    oooooh!!!
    got some!
    udhcpc[321]:
    oooooh!!! got some!
    Lease
    of 10.20.29.40 obtained, lease time 14400
    udhcpc[321]:
    Lease of 10.20.29.40 obtained, lease time 14400
    vforking
    and execle'ing /usr/share/udhcpc/default.script
    udhcpc[321]:
    vforking and execle'ing /usr/share/udhcpc/default.script
    script
    /usr/share/udhcpc/default.script failed: No such file or directory
    udhcpc[323]:
    script /usr/share/udhcpc/default.script failed: No such file or dir
    ectory
    entering
    none listen mode
    从上面我们可以看出有错误,明显可以看出是红色的地方的错误,原来是这个文件不存在,
    到baidu,google搜索一下发现,用busybox下sample文件夹下的simple.script代替即可。
    root@FriendlyARM
    /bin]#mkdir /usr/share/udhcpc
    root@FriendlyARM
    /bin]# mv /mnt/simple.script [color="#ff0000"]/usr/share/udhcpc/default.script
    [color="#ff0000"]下面再试下udhcpc看行不行
    [root@FriendlyARM
    /bin]# udhcpc eht0
    v
    dhcpc (v1.2.0) started
    adapter
    index 3
    adapter
    hardware address 00:13:f6:6c:87:89
    vforking
    and execle'ing /usr/share/udhcpc/default.script
    entering
    raw listen mode
    Opening
    raw socket on ifindex 3
    adding
    option 0x35
    adding
    option 0x3d
    adding
    option 0x3c
    Sending
    discover...
    Waiting
    on select...
    oooooh!!!
    got some!
    adding
    option 0x35
    adding
    option 0x3d
    adding
    option 0x3c
    adding
    option 0x32
    adding
    option 0x36
    Sending
    select for 10.20.29.40...
    Waiting
    on select...
    oooooh!!!
    got some!
    adding
    option 0x35
    adding
    option 0x3d
    adding
    option 0x3c
    adding
    option 0x32
    adding
    option 0x36
    Sending
    select for 10.20.29.40...
    Waiting
    on select...
    oooooh!!!
    got some!
    Lease
    of 10.20.29.40 obtained, lease time 14400
    vforking
    and execle'ing /usr/share/udhcpc/default.script
    deleting
    routers
    adding
    dns 202.112.14.151
    adding
    dns 202.112.14.161
    entering
    none listen mode
    [color="#ff0000"]看来成功了
    [color="#ff0000"]下面测试下
    root@FriendlyARM
    /bin]# ping www.uestc.edu.cn
    PING
    www.uestc.edu.cn (202.112.14.184): 56 data bytes
    64
    bytes from 202.112.14.184: icmp_seq=0 ttl=121 time=1.5 ms
    64
    bytes from 202.112.14.184: icmp_seq=1 ttl=121 time=1.1 ms
    64
    bytes from 202.112.14.184: icmp_seq=2 ttl=121 time=1.2 ms
    64
    bytes from 202.112.14.184: icmp_seq=3 ttl=121 time=1.2 ms
    64
    bytes from 202.112.14.184: icmp_seq=4 ttl=121 time=1.3 ms
    64
    bytes from 202.112.14.184: icmp_seq=5 ttl=121 time=1.2 ms
    64
    bytes from 202.112.14.184: icmp_seq=6 ttl=121 time=1.5 ms
    64
    bytes from 202.112.14.184: icmp_seq=7 ttl=121 time=2.3 ms
    64
    bytes from 202.112.14.184: icmp_seq=8 ttl=121 time=1.2 ms
    成功
    访问ftp测试
    [root@FriendlyARM
    /bin]# ftp ftp1.stuhome.net
    Connected
    to ftp1.stuhome.net.
    220
    202.115.22.17 FTP server ready
    Name
    (ftp1.stuhome.net:root): qsh_sjj0412
    331
    Password required for qsh_sjj0412
    Password:
    230
    User qsh_sjj0412 logged in
    Remote
    system type is UNIX.
    Using
    binary mode to transfer files.
    ftp>
    dir
    200
    PORT command successful
    150
    Opening ASCII mode data connection for file list
    drwxrwxr-x
    10 qsh_sjj0412 download      256 Mar 15 13:03 ACG
    drwxr-xr-x
    18 qsh_sjj0412 download      688 Sep 18 15:02 Game
    ftp>
    cd Game
    250
    CWD command successful
    ftp>dir

    drwxrwxr-x
      3 qsh_sjj0412 download      280 Feb 24 15:20 ??????????????????SPT?
    ??
    drwxrwxr-x
      4 qsh_sjj0412 download      304 Feb 24 15:22 ??????????????????ETC?
    ??
    drwxrwxr-x
      4 qsh_sjj0412 download      128 Jun 22  2008 ??????????????????TCG?
    ??
    drwxrwxr-x
      5 qsh_sjj0412 download      352 Mar 13 01:58 ???????????????AVG???
    drwxrwxr-x
    17 qsh_sjj0412 download      912 Feb 28 04:10 ???????????????ACT???
    drwxrwxr-x
    10 qsh_sjj0412 download     1072 Feb 28 04:10 ?????????????????????R
    TS???
    drwxrwxr-x
      6 qsh_sjj0412 download      424 Feb 24 11:47 ??????????????????STG?
    ??
    drwxrwxr-x
      3 qsh_sjj0412 download      240 Mar 13 01:58 ???????????????FGT???
    drwxrwxr-x
      5 qsh_sjj0412 download      248 Mar  2 07:47 ???????????????
    drwxrwxr-x
      5 qsh_sjj0412 download      464 Feb 28 04:10 ???????????????SIM???
    drwxrwxr-x
      6 qsh_sjj0412 download      560 Dec 24 16:23 ????????????
    drwxrwxr-x
      7 qsh_sjj0412 download      544 Mar  2 06:44 ???????????????RCG???
    drwxrwxr-x
    18 qsh_sjj0412 download     1280 Mar 14 01:48 ??????????????????????
    ???????????FPS???
    drwxrwxr-x
    17 qsh_sjj0412 download     1224 Dec 24 16:26 ???????????????SLG???
    drwxrwxr-x
    22 qsh_sjj0412 download     1728 Mar  2 05:42 ?????????????????????R
    PG???
    226
    Transfer complete
    ftp>
    成功。
    下一步打算实现开发板路由功能,这样我们的主机就可以通过开发板上网了,开发板就相当于802.1x路由器了。
                   
                   
                   
                   
                   
                   
                   
                   
                   

    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/89957/showart_1866329.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP