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

Asked by Kiran Akella on 2012-09-09

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:
2012-09-09
Last query:
2012-09-09
Last reply:
2012-09-09

sudo ifdown eth0

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

Kiran Akella (kiranakella) said : #3

Thank you very much.