Chinaunix首页 | 论坛 | 博客
  • 博客访问: 139792
  • 博文数量: 49
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 595
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-25 23:08
文章分类
文章存档

2011年(1)

2009年(48)

我的朋友

分类: LINUX

2009-06-07 10:46:35


iw help
iw list
iw dev wlan0 scan
iw event
iw event -f
iw event -t
iw dev wlan1 station dump
iw dev wlan1 station get

支持模式
# monitor
# managed [also station]
# wds
# mesh [also mp]
# ibss [also adhoc



Monitor flags possible

The following are flags you can specify:

    * none
    * fcsfail
    * plcpfail
    * control
    * otherbss
    * cook

iw phy phy0 interface add moni0 type monitor
iw phy phy0 interface add wlan10 type managed
iw dev wlan0 interface add fish0 type monitor flags none
tcpdump -i fish0 -s 65000 -p -U -w  /tmp/fishing.dump
iw dev moni0 del
iw dev wlan0 set freq 2412
iw dev wlan0 set channel 1
iw reg set alpha2(wpa_supplicant (as of 0.6.7) add a "COUNTRY=US" to change your regulatory domain)
iw phy phy0 interface add mesh0 type mp mesh_id mymesh
iw dev mesh0 station dump
iw dev mesh0 mpath dump

iw dev wlan0 interface add mesh type mp mesh_id $MESH_ID
ifconfig -a | grep mesh
ifconfig mesh up
iw dev set channel (or iwconfig channel )
ifconfig (ifconfig mesh 192.168.3.80)
iw dev mesh station dump

ping -c 2 192.168.10.87
arp 192.168.10.87
iw dev mesh mpath dump


Advanced Tinkering

    * You can modify the mesh path table with these commands:
          o iw dev mesh mpath $DST_ADDR del: to delete a mesh path entry.
          o iw dev mesh mpath $DST_ADDR add next_hop $NEXTHOP_ADDR to force a specific network topology.
    * You can modify the mesh peer links table with these commands:
          o iw dev mesh station dump: list all the plinks.
          o iw dev mesh station $HW_ADDR set plink_action [open|block]: trigers a specific peer link stablishment process or blocks a specific peer link.
          o iw dev mesh station del $HW_ADDR: deletes a peer link from the peer table.

    * You can get and set mesh parameters using the "mesh_param" command in iw. For example, to change the mesh TTL value (which defaults to 5), one would:

      # iw dev mesh get mesh_param mesh_ttl
      5
      # iw dev mesh set mesh_param mesh_ttl 3

The following mesh parameters can be inspected and set:

    * mesh_retry_timeout
    * mesh_confirm_timeout
    * mesh_holding_timeout
    * mesh_max_peer_links
    * mesh_max_retries
    * mesh_ttl
    * mesh_auto_open_plinks
    * mesh_hwmp_max_preq_retries
    * mesh_path_refresh_time
    * mesh_min_discovery_timeout
    * mesh_hwmp_active_path_timeout
    * mesh_hwmp_preq_min_interval
    * mesh_hwmp_net_diameter_traversal_time

如何在mesh的基础上桥接网络?
Mesh Portal (MPP)
To bring up an MPP we need to setup up a bridge between a mesh interface and, for example, an Ethernet interface.

1. Bring up a mesh interface as described in the "Testing" section above.

mpp$ iw dev wlan0 interface add mesh type mp mesh_id ${MESH_ID}
mpp$ ifconfig mesh up

2. Add this new interface and your ethN interface to a new bridge:

mpp$ brctl addbr br0
mpp$ brctl stp br0 off
mpp$ brctl addif br0 eth1
mpp$ brctl addif br0 mesh
mpp$ ifconfig mesh down
mpp$ ifconfig eth1 down
mpp$ ifconfig mesh 0.0.0.0 up
mpp$ ifconfig eth1 0.0.0.0 up
mpp$ ifconfig br0 ${MESH_IP}

如何设置桥接
root@bridge:~> brctl addbr br0
root@bridge:~> brctl stp br0 off
root@bridge:~> brctl addif br0 eth0
root@bridge:~> brctl addif br0 eth1
root@bridge:~> ifconfig eth0 down
root@bridge:~> ifconfig eth1 down
root@bridge:~> ifconfig eth0 0.0.0.0 up
root@bridge:~> ifconfig eth1 0.0.0.0 up
root@bridge:~> ifconfig br0 10.0.3.129        
设置完成,大楖有30秒才生效
When we just fired up the bridge interface it takes about roughly 30 seconds until the bridge is fully operational.

如何设置路由
We imagine this scenario or similar:

                                                              /\
              Ethernet           Ethernet           ATM    /-/  \
    ---------          ---------          ---------     /-/      |
    |  Box  |----------|Bridge |----------|Router |-----| Inter-  \
    ---------          ---------          ---------     \  net  ---|
             ^        ^         ^        ^               \     /
             |        |         |        |                \---/
            eth0     eth0      eth1     if0                 ^
             |        |         |        |                  |
          10.0.3.2   none/10.0.3.1      195.137.15.7    anything else
                      \         /
                       \       /
       ^                \-br0-/
       |                                      ^             ^
       |                   ^                  |             |
       |                   |                  |             |
      own                 own              foreign        hostile
            


root@bridge:~> echo "1" > /proc/sys/net/ipv4/ip_forward 打开IP转发
root@bridge:~> route add default gw 10.0.3.129 设置缺省路由

root@bridge:~> iptables -P FORWARD DROP
root@bridge:~> iptables -F FORWARD
root@bridge:~> iptables -I FORWARD -j ACCEPT
root@bridge:~> iptables -I FORWARD -j LOG
root@bridge:~> iptables -I FORWARD -j DROP
root@bridge:~> iptables -A FORWARD -j DROP
root@bridge:~> iptables -x -v --line-numbers -L FORWARD
root@bridge:~> iptables -D FORWARD 1
root@bridge:~> iptables -x -v --line-numbers -L FORWARD
root@box:~> ping -c 3 195.137.15.7
 
配置完成用ifconfig会看到br0       eth0    eth1     lo
route -n

参考桥接
阅读(5009) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~