-1

Normal way

As we all know, we can connect wired Ethernet by this way. When there is no Ubuntu desktop GUI, however, i have found no way to connect or disconnect that wired Ethernet.

Moreover, i am using campus network. That means what should i do is click "Turn Off" or "Turn On",and i don't have to enter a broadband account and password.

So are there any terminal commands can realize the clicking of "Turn Off" or "Turn On" ?

Lucien Xhh
  • 317
  • 1
  • 6
  • 1
    As this is absolutely not programming related, you should ask this question on askubuntu or superuser – fvu Apr 29 '22 at 09:04
  • in fact, it's related to programming to some extent, for i' d like to write a script to realize the clicking to "Turn Off" and "Turn On" at specific time – Lucien Xhh Apr 29 '22 at 09:27

1 Answers1

0

Yes you can but using the ifconfig command

Assuming that this is your only port then it will have the tag of eth0

Which will mean the command is

sudo ifconfig eth0 down 

Down switches the port off, if I want to turn it on the command is

 sudo ifconfig eth0 up

Handy guide for some Linux Terminal commands to do with ifconfig https://www.tecmint.com/ifconfig-command-examples/#:~:text=The%20“down”%20or%20“ifdown,is%20in%20an%20inactive%20state.

Will
  • 818
  • 3
  • 14
  • in my computer, the tag name is eno1. i use 'sudo ifconfig eno1 down', it works. however, 'sudo ifconfig eno1 up' fails, it enable the network, but i have to click 'turn on' manually. though i can make it connect automatically, my original intention is to connect it manually. – Lucien Xhh Apr 29 '22 at 09:20
  • do you get a error when you run the up command or does it just silently fail? – Will Apr 29 '22 at 10:16
  • it works, the Network Interface is disabled. when i use 'sudo ifconfig eno1 up' enable the network interface, i still have to click "turn on" to connect to wired ethernet – Lucien Xhh Apr 29 '22 at 10:42