how do I turn on and off a wired network from terminal

Asked by Kiran Akella

I wish to turn on or turn off a wired network from the keyboard. I can do that from the networking icon on the right top corner of my desktop. But I wish to do it using the keyboard.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Solved by:
Kiran Akella
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

sudo ifdown eth0

Revision history for this message
Thomas Krüger (thkrueger) said :
#2

The command from Andrew will work when you have configured your network in /etc/network/interfaces only.

If you are using network manger, you should run
nmcli con; nmcli dev
first to get a list of the connections and devices.

Then you can disconnect a NIC with
nmcli dev disconnect iface eth0
where eth0 is the interface device and might be named different.

To reconnect, you have to connect a connection, not a device, by it's UUID, example:
nmcli con up uuid 297b7bfc-70ce-42b6-8a42-76a3a3b90765

Revision history for this message
Kiran Akella (kiranakella) said :
#3

Thank you very much.