Score:2

After I stop NetworkManager and restart it, I still don't connect to wi-fi?

dz flag

I'm using Ubuntu 22.04.2 LTS

For context I'm trying to get Wireshark to monitor my wifi interface and having trouble.

These are the commands I am using:

1.sudo service NetworkManager stop

2.sudo ip link set <interface> down

3.sudo iw <interface> set monitor none

  1. sudo ip link set <interface> up

  2. sudo service NetworkManager restart

I expect my wifi to reconnect here but nothing happens. I checked sudo systemctl status NetworkManager and it says that Network Manager is active.

I've tried nmcli networking on with no luck. Also sudo ifconfig <interface> down and ifconfig <interface> up. Doesn't work. If I take out all the NetworkManager commands I get off of wifi and get onto wifi with no problems, but can't seem to maintain monitor mode once I get on Wireshark. And one of the suggestions on a Wireshark forum was to turn off and on Network Manager so here I am trying to make this work.

How do I get back on wifi from here without having to restart my computer?

chili555 avatar
cn flag
I think you need: `sudo iw <interface> set type managed`
Score:3
bo flag

If you just want to monitor traffic from your connection while you are connected to wifi, you don't need to use monitor mode.

Also, NetworkManager won't connect to your wifi AP if the device is in monitor mode, it has to be in managed mode to be managed by NetworkManager.

First, run the following command to get back into managed mode:

sudo iwconfig <device> mode managed 

and then restart NetworkManager:

sudo systemctl restart NetworkManager

This should connect you back to your wifi network access point or at least you should be able to select your access point from the list of available networks to connect if it doesn't connect automatically.

So if you just want to monitor traffic to and from your device, you can simply run wireshark:

sudo -i wireshark

and then select your interface from the list of devices. Example: wlp1s0

It should start capturing traffic.

Now if you really want to use monitor mode, you can create a separate virtual interface in monitor mode.

Use the following to list your devices:

iw dev

This should show something like phy#0.

Using phy#0 as an example, we would use phy0 in the following command to add a monitor device named mon0:

sudo iw phy phy0 interface add mon0 type monitor

Now, bring the device up:

sudo ifconfig mon0 up

At this point, you can stop NetworkManager and run Wireshark in wireless monitor mode:

sudo systemctl stop NetworkManager
sudo -i wireshark

and select mon0 from your list of interfaces.

You will not be able to use the internet from your device without NetworkManager but you will be sniffing all kinds of traffic monitored from other devices broadcasting within range.

It is possible to monitor using mon0 while using NetworkManager to connect to the internet through wlp1s0 or whatever your regular wireless device is. But I don't think that is ideal and when I've done this, it doesn't seem to sniff all the other devices broadcasting within range.

Also, when you're done using Wireshark, you can delete your monitor device:

sudo iw dev mon0 del
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.