Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 44120  / 2 Years ago, tue, september 6, 2022, 11:37:43

What is the command line equivalent of unchecking "Enable Networking" (disabling networking) and then re-enabling?



In my environment, there are multiple networks which require me to physically move my network cable. Sometimes my connection does not refresh properly, so I disable/re-enable networking to refresh my connection. Being able to do this from the command line would be much more efficient for me.



I'm using 12.04 LTS.


More From » networking

 Answers
4

I'd use the nmcli commands for that purpose:



nmcli nm enable false && nmcli nm enable true


man page:



DESCRIPTION
nmcli is a command‐line tool for controlling NetworkManager and report‐
ing on its status. It is not meant as a full replacement for nm‐applet
or other similar clients but as a complementary utility to those pro‐
grams. The main usage for nmcli is on servers, headless machines or
for power users who prefer the command line.

[...]

nm NetworkManager
Use this object to inquire and change state of NetworkManager.

[...]

enable [true|false]
Get networking‐enabled status or enable/disable network‐
ing by NetworkManager. All interfaces managed by Net‐
workManager are deactivated when networking has been dis‐
abled.
Reference to D‐Bus:
interface: org.freedesktop.NetworkManager
method: Enable
arguments: TRUE or FALSE

[#26205] Wednesday, September 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ongdiligenc

Total Points: 452
Total Questions: 111
Total Answers: 107

Location: Ukraine
Member since Sun, Dec 13, 2020
3 Years ago
ongdiligenc questions
Wed, Apr 13, 22, 10:34, 2 Years ago
Tue, Jun 7, 22, 00:54, 2 Years ago
Sat, Aug 7, 21, 00:37, 3 Years ago
Sat, May 22, 21, 03:06, 3 Years ago
Tue, Mar 1, 22, 10:05, 2 Years ago
;