How To Enable (UP) And Disable (DOWN) A Network Interface Port (NIC) In Linux?
======
You may need to run these commands based on your requirements.
I can tell you few examples, where you would be needed this.
When you add a new network interface or when you create a new virtual network interface from the original physical interface.
you may need to bounce these commands to bring up the new interface.
Also, if you made any changes or if it’s down then you need to run one of the below commands to bring them up.
It can be done on many ways and we would like to add best five method which we used in the article.
It can be done using the below five methods.
* **`ifconfig Command:`** The ifconfig command is used configure a network interface. It provides so many information about NIC.
* **`ifdown/up Command:`** The ifdown command take a network interface down and the ifup command bring a network interface up.
* **`ip Command:`** ip command is used to manage NIC. It’s replacement of old and deprecated ifconfig command. It’s similar to ifconfig command but has many powerful features which isn’t available in ifconfig command.
* **`nmcli Command:`** nmcli is a command-line tool for controlling NetworkManager and reporting network status.
* **`nmtui Command:`** nmtui is a curses‐based TUI application for interacting with NetworkManager.
The below output shows the available network interface card (NIC) information in my Linux system.
```
# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 192.168.1.3/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s8
valid_lft 86049sec preferred_lft 86049sec
inet6 fe80::32b7:8727:bdf2:2f3/64 scope link noprefixroute
valid_lft forever preferred_lft forever
```
### 1) How To Bring UP And Bring Down A Network Interface In Linux Using ifconfig Command?
The ifconfig command is used configure a network interface.
It is used at boot time to set up interfaces as necessary. It provides so many information about NIC. We can use ifconfig command when we need to make any changes on NIC.
Common Syntax for ifconfig:
```
# ifconfig [NIC_NAME] Down/Up
```
Run the following command to bring down the `enp0s3` interface in Linux. Make a note, you have to input your interface name instead of us.
```
# ifconfig enp0s3 down
```
Yes, the given interface is down now as per the following output.
```
# ip a | grep -A 1 "enp0s3:"
2: enp0s3: mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
inet 192.168.1.4/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s3
valid_lft 86294sec preferred_lft 86294sec
inet6 fe80::3899:270f:ae38:b433/64 scope link noprefixroute
valid_lft forever preferred_lft forever
```
### 4) How To Enable And Disable A Network Interface In Linux Using nmcli Command?
nmcli is a command-line tool for controlling NetworkManager and reporting network status.
It can be utilized as a replacement for nm-applet or other graphical clients. nmcli is used to create, display, edit, delete, activate, and deactivate network
connections, as well as control and display network device status.
Run the following command to identify the interface name because nmcli command is perform most of the task using `profile name` instead of `device name`.