How to enable and disable network cards in Linux (not comprehensive but easy to use)
Enabling disabling the network card can be done in the following ways:
Ifconfig command: used to configure the network card, can provide a lot of information about the network card.
Common syntax for ifconfig:
# ifconfig [NIC_NAME] Down/Up
Execute the following command to disable the enp0s3 network card.
# ifconfig enp0s3 down
Execute the following command to enable the enp0s3 network card.
# ifconfig enp0s3 up
Ifdown/up command: the ifdown command is used to disable the network card, and the ifup command is used to enable the network card.
Common syntax for ifdown/ifup:
# ifdown [NIC_NAME]
# ifup [NIC_NAME]
Execute the following command to disable the eth2 network card.
# ifdown eth2
Execute the following command to enable the eth2 network card.
# ifup eth2
Ip command: used to manage the network card to replace the old, deprecated ifconfig command. The ip command is similar to the ifconfig command, but provides powerful features that many ifconfig commands do not have.
Nmcli command: a command-line tool that controls NetworkManager and reports the status of the network.
Nmtui command: a terminal UI application that interacts with NetworkManager and is based on curses graphics library.