Temporarily disable internet

I looked up how to do this some time ago. The answer on ask ubuntu is to run nmcli nm enable false
this worked a month or so ago but this no longer works as it returns an error saying that nm isn’t understood. I searched the error and the arch wiki for the arch equivalent but had no luck finding anything. I did get reminded by the arch wiki about disable the network manager service from systemd but wanted to verify that that’s the only way on arch nowadays.

Just a guess… :arrow_down:

sudo systemctl stop NetworkManager.service

… maybe?

yep like I said just wanted to be sure that that is the only way I was about to do it but got worried that I’d have reconfigure stuff when I restarted it. I even looked at plasma-nm but got surprised that it only shows the network interfaces but you can’t actually do anything in there.

Not normally. The whole idea behind NetworkManager is that it’s pretty much plug & play. :thinking:

1 Like

What devices do you have then?

ip a

(dont show here because IP’s and such)

Then you can

sudo ip link set {DEV_ID} down
sudo ip link set {DEV_ID} up

Also I just checked… and nmcli is super simple:

nmcli n off
nmcli n on

Where ‘n’ is for networking … see nmcli --help:

Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }

OPTIONS
  -a, --ask                                ask for missing parameters
  -c, --colors auto|yes|no                 whether to use colors in output
  -e, --escape yes|no                      escape columns separators in values
  -f, --fields <field,...>|all|common      specify fields to output
  -g, --get-values <field,...>|all|common  shortcut for -m tabular -t -f
  -h, --help                               print this help
  -m, --mode tabular|multiline             output mode
  -o, --overview                           overview mode
  -p, --pretty                             pretty output
  -s, --show-secrets                       allow displaying passwords
  -t, --terse                              terse output
  -v, --version                            show program version
  -w, --wait <seconds>                     set timeout waiting for finishing operations

OBJECT
  g[eneral]       NetworkManager's general status and operations
  n[etworking]    overall networking control
  r[adio]         NetworkManager radio switches
  c[onnection]    NetworkManager's connections
  d[evice]        devices managed by NetworkManager
  a[gent]         NetworkManager secret agent or polkit agent
  m[onitor]       monitor NetworkManager changes

(for the record … the nmcli option seemed to be ‘faster’ so maybe stick with that)

2 Likes

thank you thank you thank you. I saw n as an arg but didn’t know what the third arg had to be.

Protip:
Sometimes you can get more by passing ‘–help’ to the option in question. ex:

$ nmcli n --help
Usage: nmcli networking { COMMAND | help }

COMMAND := { [ on | off | connectivity ] }

  on

  off

  connectivity [check]

:slight_smile:

2 Likes

I forgot that you can pass -h like that.

Well … ‘help’ is technically an option of the program.
The developer has to put it in there.
And the same goes for ‘secondary help’ like above.
And as thats not all exactly standardized … its entirely hit and miss :woman_shrugging:

2 Likes

On XFCE, there is a Network Manager Applet on the Panel. If you right-click, there is an option to enable/disable the Network. The icon changes based on state.

KDE has it’s own too in the System Tray, but left-click and select the connection and click the button on the right.

+1 what more simple than this

Depends … you might want it for a script or a networked machine.
OP didnt specify their use-case … but they did specify their need clearly … and the solution was offered.

Although the original question referenced a specific command, they did end by asking, is that the only way on arch nowadays. Sometimes we get set in our ways and therefore aren’t aware of different tools and new features. The topic was not closed and the panel tools had not yet been mentioned. Should we not reply to an open topic with an accepted solution?

No it’s definitely welcome to reply to a topic that already has a solution as far as I know. What tools are you referring to? The reason I was asking if the systemd method was the only way is because having to go out of my way to use systemd to manually stop the service and restart it felt more involved than I thought it had to be. Even if the commands I marked as the solution does the same thing it doesn’t feel as involved because it’s so short. Plus it doesn’t require being root.

Edit:
please ignore my question I didn’t read the posts above I will look into the KDE GUI method.

You can also use the code yay -Syu.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.