Damirados

Damirados

VintageNet how to put interface into monitor mode

Hi I am trying to setup wfb-ng on my rpi0_2.

To get it working I need to put wifi interface into monitor mode.

I have managed to build custom driver for Wi-Fi card and get it working and showing up as wlan1.

iex(3)> ifconfig
lo: flags=[:up, :loopback, :running]
    inet 127.0.0.1  netmask 255.0.0.0
    inet ::1  netmask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
    hwaddr 00:00:00:00:00:00

wlan0: flags=[:up, :broadcast, :running, :multicast]
    inet 192.168.178.141  netmask 255.255.255.0  broadcast 192.168.178.255
    inet 2a02:8108:96c0:5a77:e65f:1ff:fe45:e52  netmask ffff:ffff:ffff:ffff::
    inet fe80::e65f:1ff:fe45:e52  netmask ffff:ffff:ffff:ffff::
    hwaddr e4:5f:01:45:0e:52

wlan1: flags=[:broadcast, :multicast]
    hwaddr 1c:a7:70:77:f2:76

Usual next steps are on standard linux systems is putting interface in unmanaged state. Currently iw on my nerves config says it’s managed.

iex(4)> cmd("iw dev wlan1 info")
Interface wlan1
	ifindex 3
	wdev 0x100000001
	addr 1c:a7:70:77:f2:76
	type managed
	wiphy 1
	txpower 18.00 dBm

I am using following VintageNet config:

config :vintage_net,
  regulatory_domain: "DE",
  config: [
    {"usb0", %{type: VintageNetDirect}},
    {"eth0",
     %{
       type: VintageNetEthernet,
       ipv4: %{method: :dhcp}
     }},
    {"wlan0",
     %{
       type: VintageNetWiFi,
       vintage_net_wifi: %{networks: [network]},
       ipv4: %{method: :dhcp}
     }},
    {"wlan1", type: VintageNet.Technology.Null}
  ]

Next step would involve running following commands as root to set interface into monitor mode:

ip link set <interface> down
iw dev <interface> set monitor otherbss
ip link set <intreface up

I cannot run all of that commands. Reason might be that inferface is still managed or that I am not allowed because of some linux rules setup for the shell. They return following:

iex(9)> cmd("ip link set wlan1 up")
ip: SIOCSIFFLAGS: Operation not permitted
2
iex(10)> cmd("ip link set wlan1 down")
0
iex(11)> cmd("iw dev wlan1 set monitor otherbss")
command failed: Operation not permitted (-1)
255
iex(12)> cmd("ip link set wlan1 up")
ip: SIOCSIFFLAGS: Operation not permitted
2
iex(13)>

Marked As Solved

Damirados

Damirados

Summary to complete the thread so it matches the title.

If you want to use wifi card that supports it in monitor mode:

  • create custom nerves system
  • if you need special driver add custom buildroot package, you will also need to enable usb and usb_net in kernel config
  • add iw buildroot package
  • make sure that your wifi card is properly powered otherwise buggy behavior is possible

I will link PR on my nerves system when I clean it up.

Also Liked

Damirados

Damirados

It seems to be power. Rpi zero doesn’t provide enough power to the WiFi board over usb. Currently it doesn’t show up directly on boot, only after I unplug it and replug it, after that it everything seems to work normally and I am able to put into monitor mode using iw.

fhunleth

fhunleth

Co-author of Nerves

I’m a little late to this. I’m glad you got it working!

Just to clarify things if others stumble on this thread, VintageNet.Technology.Null does the same thing as not listing a network interface in your configuration. Sometimes it’s useful to be explicit that a network interface is not to be managed by VintageNet. Also, ChatGPT should have mentioned that you can limit what network interfaces wpa_supplicant will handle. VintageNet does that so if you have multiple WiFi network interfaces, there’s a wpa_supplicant instance for each one.

Amazingly, this power issue comes up periodically. I sure wish there were a better error message.

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement