2

I'm using the iw tool to configure a WiFi interface to sniff the air (monitor mode) on specific channel:

ifconfig wlan0 down
iw dev wlan0 set channel 1
iwconfig wlan0 mode monitor
ifconfig wlan0 up

The manpage for iw says that the channel bandwidth is optional:

dev <devname> set channel <channel> [HT20|HT40+|HT40-]

But it's not clear what value of the three is the default and according to what it's chosen?

Using Ubuntu Ubuntu 12.04.4, kernel 3.5.0-45-generic.

1

There is no default, because it always depends the hardware capabilities and the configuration. They are always negotiated at handshake stage. To see your WiFi capabilites use

iw phy

See also HT20/40.

Some tcpdump wireless filters.

  • But when sniffing data packets, how will it know which Access Point is of interest? There are many irrelevant data packets that can be of an AP that's configured in 40MHz, or of an AP that's configured in 20MHz. Also that interface is used to sniff the packets, not to connect to an AP (so it will not have an handshake with any AP). Thx – Dor Apr 8 '14 at 16:27
  • Ok, but this is a different Q. Monitor mode does not depend any station id. See documentation. Get you station id i.e. iw (station dump). You can add any constraint with tcpdump as you like. – user55518 Apr 8 '14 at 16:40
  • Ok, I need to correct this: If you set the channel or frequency, it listens only on these, so you need to set frequency or channel first. On which, depends always your configuration. – user55518 Apr 8 '14 at 17:21
  • 1
    Why it's a different question? An interface is in monitor mode. I'm configuring it to listen on a specific channel. Also, I have 2 Access Points on that channel, one AP is configured to have 20MHz channel width, the other AP has 40MHz. The sniffing interface, which is in monitor mode, needs to decide arbitrarily what is the channel width to set. How does it do that? According to that decision, it will be able to sniff data packets of only a single AP of the two that I mentioned. – Dor Apr 9 '14 at 5:32
  • 1
    I meant what is the default when running the command iw dev wlan0 set channel 4 (or any other channel; which is not executed on the station). I didn't mean to the default channel width that the station sets when connecting to an AP. Note that the sniffing interface is on a totally different PC, not connecting to any AP, only listening. – Dor Apr 10 '14 at 11:18
0
ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up
iw dev wlan0 set channel 1

set channel after up, because after up settings reset to default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.