国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

電子工程網

標題: 飛凌S3C2440開發板路由實驗代碼 [打印本頁]

作者: yanhong    時間: 2010-7-22 13:56
標題: 飛凌S3C2440開發板路由實驗代碼
PS:
本文轉自 飛凌嵌入式技術交流群
這個是由群里一些工程師朋友做的小實驗,可以作為參考。
嵌入式Linux簡單路由實驗
    本實驗所用硬件平臺為飛凌(www.witech.com.cn)TE2440V2型開發板;該開發板上有兩個網卡芯片,分別為CS8900和DM9000;在linux操作系統(采用2.6.12版本的內核)下兩個網卡對應的設備名分別為eth0和eht1。
    本實驗中TE2440V2開發板作為路由器連接兩個局域網:192.168.0.*和192.168.1.*,對應網關分別為192.168.0.3和192.168.1.3。
1. 配置開發板上兩個網卡的IP地址:
# ifconfig eth0 192.168.0.3 up
# ifconfig eth0 192.168.1.3 up        
用ifconfig命令查看網卡信息如下:
        # ifconfig
        eth0      Link encap:Ethernet  HWaddr 00:00:02:50:10:08
                  inet addr:192.168.0.3 Bcast:192.168.0.255
                  Mask:255.255.255.0
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:33310 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:5437 errors:55 dropped:0 overruns:25 carrier:5
                  collisions:798 txqueuelen:1000
                  RX bytes:6283109 (5.9 MiB)  TX bytes:3796550 (3.6 MiB)
                  Interrupt:53 Base address:0x300
        
        eth1      Link encap:Ethernet  HWaddr 00:12:34:56:80:49
                  inet addr:192.168.1.3 Bcast:192.168.1.255
                  Mask:255.255.255.0
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:38618 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:2997 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:1000
                  RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
                  Interrupt:51 Base address:0x8300

2. 開啟Linux內核的路由轉發功能(注意1后面有空格):
#echo 1 >/proc/sys/net/ipv4/ip_forward        
可通過如下命令查看路由轉發是否開啟,1為開啟,0為關閉。
# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
# more /proc/sys/net/ipv4/ip_forward
1        
路由表不用配置,用自動生成的就可以:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0        
3. 測試:用兩個局域網內(192.168.0.*、192.168.1.*)的PC機,分別將其默認網關設置為192.168.0.3和192.168.1.3(這里對應路由器的IP地址),然后用ping命令測試。我用的兩個客戶機的IP分別為192.168.0.221和192.168.1.228,測試結果如下:
C:\Documents and Settings\Administrator>ipconfig
Windows IP Configuration
Ethernet adapter 本地連接 5:
        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 192.168.1.228
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.1.3
C:\Documents and Settings\Administrator>ping 192.168.0.221 -l 65500
Pinging 192.168.0.221 with 65500 bytes of data:
Reply from 192.168.0.221: bytes=65500 time=298ms TTL=63
Reply from 192.168.0.221: bytes=65500 time=244ms TTL=63
Reply from 192.168.0.221: bytes=65500 time=230ms TTL=63
Reply from 192.168.0.221: bytes=65500 time=257ms TTL=63
Ping statistics for 192.168.0.221:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 230ms, Maximum = 298ms, Average = 257ms
C:\Documents and Settings\Administrator>ipconfig
Windows IP Configuration

Ethernet adapter 本地連接 3:
        Connection-specific DNS Suffix  . :
        IP Address. . . . . . . . . . . . : 192.168.0.221
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.0.3
C:\Documents and Settings\Administrator>ping 192.168.1.228 -l 65500
Pinging 192.168.1.228 with 65500 bytes of data:
Reply from 192.168.1.228: bytes=65500 time=240ms TTL=127
Reply from 192.168.1.228: bytes=65500 time=263ms TTL=127
Reply from 192.168.1.228: bytes=65500 time=226ms TTL=127
Reply from 192.168.1.228: bytes=65500 time=282ms TTL=127
Ping statistics for 192.168.1.228:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
        Minimum = 226ms, Maximum = 282ms, Average = 252ms




歡迎光臨 電子工程網 (http://www.qingdxww.cn/) Powered by Discuz! X3.4
主站蜘蛛池模板: 91小视频在线观看免费版高清 | 久久er这里只有精品 | 中文字幕成人在线 | 91视频网址入口 | 欧美人交性视频在线香蕉 | 欧美精品hd| 国产欧美一区二区三区在线看 | 亚洲第一狼人社区 | 欧美精品三级在线 | 亚洲特级片 | 99ri9| 四虎影院在线免费观看 | 亚洲国产精品成人综合色在线婷婷 | 日韩不卡在线 | 欧美日韩一区二区三区高清不卡 | 草莓香蕉绿巨人丝瓜榴莲18 | 亚洲一区二区免费在线观看 | 亚洲精品视频在线播放 | 成年人免费在线看惊悚片动作片 | 色播亚洲视频在线观看 | 国产精品亚洲欧美日韩一区在线 | 日韩一区二区三区不卡视频 | 国产精品日韩欧美一区二区三区 | 99久久久国产精品免费牛牛四川 | 全国最大色成免费网站 | 天天操天天弄 | 国产精品久久免费视频 | 香蕉视频99| 欧美精品一区二区三区免费播放 | 国产一区二区三区精品视频 | 男人天堂b | 天堂在线视频网站 | 国产高清视频91 | 免费毛片在线视频 | 久久国产热视频 | 4hu四虎永久地址 | 午夜性生活视频 | 国内欧美一区二区三区 | 毛片激情 | 丁香婷婷色 | 全免费a级毛片免费看视频免 |