


How to turn off the network card in linux
Method: 1. Use the ifconfig command to turn off the network card, the syntax is "ifconfig network card name down"; 2. Use the ifdown command to turn off the network card, the syntax is "ifdown network card name"; 3. Use the ip command to turn off the network card, the syntax For "ip link set network card name down"
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to turn off the network card in Linux
You may execute the following commands according to your needs. I'll list some examples here of where you might use these commands.
When you add a network card or create a virtual network card from a physical network card, you may need to use these commands to enable the new network card. In addition, if you have made some modifications to the network card or the network card itself is not enabled, then you also need to use one of the following commands to enable the network card.
There are many ways to enable and disable the network card. In this article, we’ll go over the top 5 methods we’ve used.
Enabling and disabling the network card can be accomplished using the following 5 methods:
ifconfig command: used to configure the network card. It can provide a lot of information about the network card.
ifdown/up command: ifdown command is used to disable the network card, and ifup command is used to enable the network card.
ip command: used to manage network cards, replacing the old and deprecated ifconfig command. It is very similar to the ifconfig command, but provides many powerful features that the ifconfig command does not have.
nmcli command: is a command line tool that controls NetworkManager and reports network status.
nmtui command: It is a terminal UI application based on the curses graphics library that interacts with NetworkManager.
The following shows the information about the network cards available in my Linux system.
# ip a 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s3: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:c2:e4:e8 brd ff:ff:ff:ff:ff:ff inet 192.168.1.4/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s3 valid_lft 86049sec preferred_lft 86049sec inet6 fe80::3899:270f:ae38:b433/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: enp0s8: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:30:5d:52 brd ff:ff:ff:ff:ff:ff 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 use the ifconfig command to enable or disable the network card?
The ifconfig command is used to configure the network card.
If you need to enable the network card during system startup, the command to call is ifconfig. ifconfig can provide a lot of network card information. No matter what configuration we want to modify the network card, we can use this command.
Common syntax of ifconfig:
# ifconfig [NIC_NAME] Down/Up
Execute the following command to disable the enp0s3 network card. Note that you need to enter your own network card name here.
# ifconfig enp0s3 down
You can see from the following output that the network card has been disabled.
# ip a | grep -A 1 "enp0s3:" 2: enp0s3: mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 08:00:27:c2:e4:e8 brd ff:ff:ff:ff:ff:ff
Execute the following command to enable the enp0s3 network card.
# ifconfig enp0s3 up
You can see from the following output that the network card has been enabled.
# ip a | grep -A 5 "enp0s3:" 2: enp0s3: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:c2:e4:e8 brd ff:ff:ff:ff:ff:ff 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
2. How to use the ifdown/up command to enable or disable the network card?
The ifdown command is used to disable the network card, and the ifup command is used to enable the network card.
Note: These two commands do not support new network devices named enpXXX.
Common syntax for ifdown/ifup:
# ifdown [NIC_NAME] # ifup [NIC_NAME]
Execute the following command to disable the eth1 network card.
# ifdown eth1
You can see from the following output that the network card has been disabled.
# ip a | grep -A 3 "eth1:" 3: eth1: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000 link/ether 08:00:27:d5:a0:18 brd ff:ff:ff:ff:ff:ff
Execute the following command to enable the eth1 network card.
# ifup eth1
You can see from the following output that the network card has been enabled.
# ip a | grep -A 5 "eth1:" 3: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:d5:a0:18 brd ff:ff:ff:ff:ff:ff inet 192.168.1.7/24 brd 192.168.1.255 scope global eth1 inet6 fe80::a00:27ff:fed5:a018/64 scope link tentative dadfailed valid_lft forever preferred_lft forever
ifup and ifdown do not support network cards named enpXXX. When executing this command, the results obtained are as follows:
# ifdown enp0s8 Unknown interface enp0s8
3. How to use the ip command to enable or disable the network card?
The ip command is used to manage network cards and replaces the old and deprecated ifconfig command.
It is very similar to the ifconfig command, but provides many powerful features that the ifconfig command does not have.
Common syntax for ip:
# ip link set Down/Up
Execute the following command to disable the enp0s3 network card.
# ip link set enp0s3 down
You can see from the following output that the network card has been disabled.
# ip a | grep -A 1 "enp0s3:" 2: enp0s3: mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 08:00:27:c2:e4:e8 brd ff:ff:ff:ff:ff:ff
Execute the following command to enable the enp0s3 network card.
# ip link set enp0s3 up
You can see from the following output that the network card has been enabled.
# ip a | grep -A 5 "enp0s3:" 2: enp0s3: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:c2:e4:e8 brd ff:ff:ff:ff:ff:ff 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 use nmcli command to enable or disable the network card?
nmcli is a command line tool that controls NetworkManager and reports network status.
nmcli can be used as a replacement for nm-applet or other graphical clients. It can be used to display, create, modify, delete, enable and deactivate network connections. In addition to this, it can also be used to manage and display network device status.
nmcli commands work in most cases using "configuration name" instead of "device name". Therefore, execute the following command to obtain the configuration name corresponding to the network card. (LCTT Translation: When using nmtui or nmcli to manage network connections, you can configure a name for the network connection, which is the configuration name Profile name mentioned here)
# nmcli con show NAME UUID TYPE DEVICE Wired connection 1 3d5afa0a-419a-3d1a-93e6-889ce9c6a18c ethernet enp0s3 Wired connection 2 a22154b7-4cc4-3756-9d8d-da5a4318e146 ethernet enp0s8
Common syntax for nmcli:
# nmcli con Down/Up
Execute the following command to disable the enp0s3 network card. When disabling a network card, you need to use the configuration name rather than the device name.
# nmcli con down 'Wired connection 1' Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
You can see from the following output that the network card has been disabled.
# nmcli dev status DEVICE TYPE STATE CONNECTION enp0s8 ethernet connected Wired connection 2 enp0s3 ethernet disconnected -- lo loopback unmanaged --
Execute the following command to enable the enp0s3 network card. Again, here you need to use the configuration name instead of the device name.
# nmcli con up 'Wired connection 1' Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
You can see from the following output that the network card has been enabled.
# nmcli dev status DEVICE TYPE STATE CONNECTION enp0s8 ethernet connected Wired connection 2 enp0s3 ethernet connected Wired connection 1 lo loopback unmanaged --
5. How to use the nmtui command to enable or disable the network card?
nmtui 是一个与 NetworkManager 交互的、基于 curses 图形库的终端 UI 应用。
在启用 nmtui 的时候,如果第一个参数没有特别指定,它会引导用户选择对应的操作去执行。
执行以下命令打开 mntui 界面。选择 “Active a connection” 然后点击 “OK”。
# nmtui
相关推荐:《Linux视频教程》
The above is the detailed content of How to turn off the network card in linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.
