1

I want an interface to run only in monitoring mode and configure it through /etc/network/interfaces

How do I configure my interface through /etc/network/interfaces to start in monitoring mode?

To make things clear, I am looking for the equivalent of

airmon-ng start wlan1 

but setup automatically in /etc/network/interfaces.


An solution would be to put the previous command in a /etc/network/if-up.d but I am looking for a more formal way of doing it.

from man wireless, the mode is set with the field `wireless-mode '. This solution is not valid

$ cat /etc/network/interfaces
[...]
auto wlan1
wireless-mode Monitor
[...]
$ /etc/network/interfaces:41: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"

PS: running on Debian 8.0

  • Run these commands: airmon-ng , airmon-ng check , airmon-ng check kill and then airmon-ng start wlan1 – defalt Dec 31 '16 at 18:28
3

Are you looking to put it in monitor mode, or promiscuous mode? There is a difference between those two:

Definition

Monitor mode

Sniffing the packets in the air without connecting (associating) with any access point. Think of it like listening to people's conversations while you walk down the street.

Promiscuous mode

Sniffing the packets after connecting to an access point. This is possible because the wireless-enabled devices send the data in the air but only "mark" them to be processed by the intended receiver. They cannot send the packets and make sure they only reach a specific device, unlike with switched LANs.

Think of it like joining a group of people in a conversation, but at the same time being able to hear when someone says "Hey, Mike, I have a new laptop". Even though you're not Mike, and that sentence was intended to be heard by Mike, but you're still able to hear it.

(credit for these definitions to Adi)

Howto

Since I guess you'll want promiscuous mode, rather than monitor mode in /etc/network/interfaces, I'll tell you how:

Promiscuous mode

If you want to do it in /etc/network/interfaces, check out this configuration:

iface eth0 static
address 192.168.2.1
up /sbin/ifconfig eth0 promisc on

The last line is the relevant one. It puts eth0 in promiscuous mode as soon as it comes online ('up').

  • Thanks for your answer which I'll use, but I am really looking for a monitor mode as initiated by airmon-ng start wlan1. – user123456 Dec 31 '16 at 18:14
  • Sure! No problem. What distro are you using? – Jeroen Janssen Dec 31 '16 at 18:42
  • Debian Jessy 8.0. Thanks again for your help. wireless-mode Monitor does not work even if wireless-mode ad-hoc is correct for Ad Hoc network. – user123456 Dec 31 '16 at 19:28
1

This configuration brings wlan0 into monitor mode at startup (Jessie).

#/etc/network/interfaces.d/wlan0
auto wlan0
iface wlan0 inet manual
  wireless-mode monitor

But I think airmon-ng also uses interface mapping.

[Addition] It works right using pre-up command

auto mon0
iface mon0 inet manual
  pre-up iw wlan0 interface add mon0 type monitor
  wireless-mode monitor
0

To make things clear, I am looking for the equivalent of

airmon-ng start wlan1

You can add a monitor interface through iw command:

iw phy phy1 interface add mon1 type monitor

To capture with mon1 interface , you can delete wlan1 interface

iw dev wlan1 del

Enable mon1

ifconfig mon1 up

Set up the frequency:

iw dev mon1 set freq put_the frequency_here

Check it with iwconfig mon1

  • Thanks for the answer. I am however looking for a configuration in /etc/network/interfaces. I guess I'll end up putting those commands in ifup.d – user123456 Jan 2 '17 at 9:57

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.