-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iw命令用法 #65
Comments
https://blog.csdn.net/robertsong2004/article/details/40044947 官方译文关于 iw 像Linux内核的其余部分,iw 仍处于开发阶段。功能被随时添加。 iw 的唯一文档就是此页和“iw help”的输出。 请帮助扩大这个页面。 有一个页面列出iwconfig和iw的用例:替换 iwconfig。 获得 iw iw发布压缩包可以从这里获取: http://kernel.org/pub/software/network/iw/. 另外,你也可以从 git 下载 iw: http://git.kernel.org/?p=linux/kernel/git/jberg/iw.git. 编译要求 libnl-dev >= libnl-dev-1 pkg-config 帮助 iw help 获取设备的功能 iw list iw dev wlan0 scan iw event iw event -f iw event -t 关联到传统(非802.11n标准)的AP的输出示例: iw dev wlan0 link iw dev wlan0 link iw dev wlan0 link 无加密 建立基本连接 无加密 如果您选择自己处理断开连接,你可以使用 iw connect 如下所示。 如要连接到已禁用加密的AP,这里它的SSID是foo : iw wlan0 connect foo iw wlan0 connect foo 2432 iw wlan0 connect foo keys 0:abcde d:1:0011223344 $ iw dev wlan1 station dump sudo iw dev wlan1 station get 修改传输比特率 修改TX传统的比特率 iw wlan0 set bitrates legacy-2.4 12 18 24 iw wlan0 set bitrates legacy-2.4 6 12 24 iw dev wlan0 set bitrates mcs-5 4 iw dev wlan0 set bitrates mcs-2.4 10 iw dev wlan0 set bitrates mcs-2.4 iw dev set txpower <auto|fixed|limit> [] sudo iw dev wlan0 set power_save on 查询当前的节电设定,您可以使用: iw dev wlan0 get power_save monitor 例如,要添加一个 monitor 接口: iw phy phy0 interface add moni0 type monitor Note that in case you want to monitor 802.11n you will need to specify channel width (20 or 20/40MHz) and in case of 20/40MHz if the upper or lower channel is being used. To do so you would use: iw dev set freq [HT20|HT40+|HT40-] iw phy set freq [HT20|HT40+|HT40-] iw phy set channel [HT20|HT40+|HT40-] iw phy phy0 interface add wlan10 type managed Modifying monitor interface flags iw dev wlan0 interface add fish0 type monitor flags none tcpdump -i fish0 -s 65000 -p -U -w /tmp/fishing.dump Keep in mind this requires drivers to honor mac80211's flag requests strictly, so drivers like ath5k and ath9k which still enable flags based on operation mode need to be fixed to take advantage of this. Monitor flags possible none iw dev moni0 del Virtual vif support Setting frequency with iw iw dev wlan0 set freq 2412 [HT20|HT40+|HT40-] iw dev wlan0 set channel 1 [HT20|HT40+|HT40-] iw reg set alpha2 You can also use the latest wpa_supplicant (as of 0.6.7) now to change your regulatory domain, to do so just add a "COUNTRY=US" entry into your configuration for example. Creating and inspecting Mesh Point interfaces with iw iw phy phy0 interface add mesh0 type mp mesh_id mymesh After sending traffic (ex: pinging another mesh node), you may wish to see a list of Mesh Paths: iw dev mesh0 mpath dump Setting up a WDS peer To create a WDS peer you will first need to create an interface of WDS type, and then set the peer: iw phy phy0 interface add wds0 type wds Using 4-address for AP and client mode Linux wireless has support for 4-address mode for AP and STAs but each driver needs to define this capability explicitly. All mac80211 drivers support 4-address mode if AP or STA modes of operation are supported respectively. On the AP side you can enable 4-address frames for individual clients by isolating them in separate AP VLANs which are configured in 4-address mode. Such an AP VLAN will be limited to one client only, and this client will be used as the destination for all traffic on its interface, regardless of the destination MAC address in the packet headers. The advantage of this mode compared to regular WDS mode is that it's easier to configure and does not require a static list of peer MAC addresses on any side. 4-address mode is incompatible with WDS. To enable 4-address mode when creating an interface you should add 4addr on, for example: iw phy phy0 interface add moni0 type managed 4addr on In hostapd you can enable this with the flag on hostapd.conf: wds_sta=1 Creating packet coalesce rules Packet coalesce feature helps to reduce number of receive interrupts to host by buffering these packets in firmware/hardware for some predefined time. Receive interrupt will be generated when one of the following events occur. Expiration of hardware timer whose expiration time is set to maximum coalescing delay of matching coalesce rule. Coalesce support: Maximum coalescing delay To enable coalesce feature using rules listed in coalesce.conf file, you can use: iw phy phy0 enable coalesce.conf delay=25 $ iw phy phy0 coalesce show
iw phy phy0 coalesce disable $ iw phy phy0 coalesce show |
https://blog.csdn.net/DXCyber409/article/details/80574111 这意味着iw既可以查看信息,又可以管理无线网络设备,还能更改配置,属于比较全能的命令。 缺点:实测对USB网卡支持性很差,几乎只适用于物理接入设备(PCI板载设备)。 常用命令列表: iw list # 查看本机支持的无线特性,such as band information (2.4 GHz, and 5 GHz), and 802.11n information 译文:https://blog.csdn.net/robertsong2004/article/details/40044947 ifconfig命令 通用的接口操作命令,但通用意味着只能做一些少量配置,例如打开关闭设备接口,配置IP、子网掩码,查看IP地址等。 ifconfig eth0 down # 关闭eth0接口 ip命令 ip命令用于显示/操作路由、设备、策略路由和隧道,和iw一样是较为综合而强大的命令,与之相似的原型命令可以看作是ifconfig。 [root@localhost ~]# ip --help ip link set wlan0 [up] [down] # 设置网络接口的开启关闭 其他常用命令格式搭配可以参阅此文:https://blog.csdn.net/radkitty/article/details/3022181 iwlist命令 DXCyber409@DXCyber409:/etc/wpa_supplicant$ iwlist --help 可以通过该命令来获取最后一次扫描的缓存信息:iwlist wlan0 scanning 对于USB网卡,要扫描周围的SSID广播,该命令几乎是唯一选项,因为iw支持不好。 iwconfig命令 DXCyber409@DXCyber409:/etc/wpa_supplicant$ iwconfig --help iwconfig wlan0 essid "WIFI名称" # 连接开放的WI-FI网络 该命令可用于WPA/WPA2-PSK/WEP加密网络的连接管理,现代WI-FI环境必备。 DXCyber409@DXCyber409:/etc/wpa_supplicant$ wpa_supplicant --help This software may be distributed under the terms of the BSD license. This product includes software developed by the OpenSSL Project usage: drivers: 博主所使用的Linux环境为Kali-Rolling,开机是会自己启动好wpa_supplicant的,因此已经提前kill掉相关进程用于演示。 首先按照手机等连接Wi-Fi的习惯,我们需要知道扫描无线网络广播并记录需要连接的SSID名称(iw命令和iwlist命令都可以完成,请查阅本文小关小节)。 根据手册我们需要一个配置文件,填入连接配置信息,sudo vim /etc/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant network={ 其中守护进程启动的-B参数如果不使用,可以看到连接过程用于监控错误的发生,例如密码输入错误。 启动后通过iwconfig命令可以看到wlan0接口已经有了Access Point地址,证明已经连接。 但ifconfig wlan0没有显示IP,此时需要获取IP地址才能上网。 dhclient wlan0 之后即可打开网页测试。 补充:USB无线网卡使用wpa_supplicant时出现错误信息 DXCyber409@DXCyber409:~$ sudo wpa_supplicant -i wlan1 -c /etc/wpa_supplicant.conf 同时在wpa_supplicant的输出中可以看到 Successfully initialized wpa_supplicant 参考文献 wpa_cli命令解析:https://blog.csdn.net/jy1075518049/article/details/51015141 linux下连接无线网出现nl80211: Could not configure driver mode nl80211: |
最后成功的上网办法
network={
ssid="Wifi Network 1"
psk="12345678"
}
network={
ssid="Wifi Network 2"
psk="87654321"
} 编辑完:ctrl+0,enter,ctrl+x |
最新的raspbian已经有了wifi必要的包,直接插上就可以用了。不过最好还是可以看看 iwconfig 确认一下,输入 iwconfig 显示如下:
(2) 设置要连接的无线网络的安全模式(仅支持WPA Version 1需要使用AuthMode=WPAPSK):
iwpriv ra0 set AuthMode=WPA2PSK
(3) 设置网络加密方式:(TKIP即为TKIP)
iwpriv ra0 set EncrypType=AES
(4) 设置连接时的密码: ********为加密网络的密码
(5) 连接该网络:有两种方式:
<1> 用iwpriv命令
iwpriv ra0 set SSID=liangym
<2> 用iwconfig命令
至此,如果密码正确,就可以连接上网络liangym了。如果你不放心,可以用命令查看状态:
当然,你也可以用iwconfig命令查看状态,这里不再赘述。
命令
使用iwlist scan[ning]的时候,是需要超级用户的权限的,所以去尝试用sudo执行
1、iwlist 命令:用于对/proc/net/wireless文件进行分析,得出无线网卡相关信息
2、iwconfig 系统配置无线网络设备或显示无线网络设备信息。iwconfig 命令类似于ifconfig命令,但是他配置对象是无线网卡,它对网络设备进行无线操作,如设置无线通信频段
3、iw 是一种新的基于 nl80211 的用于无线设备的CLI配置实用程序。它支持最近已添加到内核所有新的驱动程序。采用无线扩展接口的旧工具iwconfig已被废弃,强烈建议切换到 iw 和 nl80211。
Linux内核的其余部分,iw 仍处于开发阶段。功能被随时添加。 iw 的唯一文档就是此页和“iw help”的输出。 请帮助扩大这个页面。
有一个页面列出iwconfig和iw的用例:替换 iwconfig.
The text was updated successfully, but these errors were encountered: