Linux 中如何启用和禁用网卡? | Linux 中国

访客 阅读:19 2024-06-18 16:00:42 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址


启用、禁用网卡有很多种方法。在这篇文章里,我们会介绍我们使用过的最好的 5 种方法。 -- Magesh Maruthamuthu

你可能会根据你的需要执行以下命令。我会在这里列举一些你会用到这些命令的例子。

You may execute the following orders according to your needs. I'll give you some examples here that you will use for these orders.

当你添加一个网卡或者从一个物理网卡创建出一个虚拟网卡的时候,你可能需要使用这些命令将新网卡启用起来。另外,如果你对网卡做了某些修改或者网卡本身没有启用,那么你也需要使用以下的某个命令将网卡启用起来。

When you add a net card or create a virtual net card from a physical net card, you may need to use these commands to activate the new net card. And, if you make some changes to the net card or the net card itself is not enabled, you need to use one of the following commands to activate the net card.

启用、禁用网卡有很多种方法。在这篇文章里,我们会介绍我们使用过的最好的 5 种方法。

There are many ways to enable and disable web cards. In this article, we present the best five methods we've ever used.

启用禁用网卡可以使用以下 5 个方法来完成:

Enable the disablement of the net cards by using the following five methods:

ifconfig 命令:用于配置网卡。它可以提供网卡的很多信息。 命令: ifdown 命令用于禁用网卡, ifup 命令用于启用网卡。 ip 命令:用于管理网卡,用于替代老旧的、不推荐使用的 ifconfig 命令。它和 ifconfig 命令很相似,但是提供了很多 ifconfig 命令所不具有的强大的特性。 nmcli 命令:是一个控制 NetworkManager 并报告网络状态的命令行工具。 nmtui 命令:是一个与 NetworkManager 交互的、基于 curses 图形库的终端 UI 应用。

Ifconfig command: This is used to configure the network card. It provides a lot of information about the network card. Command: ifdown command is used to disable the network card, ifup command is used to enable the network card. ip command: This is used to manage the network card instead of the old, unrecommended, ifconfig command. It is very similar to the ifconfig command, but it provides many powerful features that are not available in the ifconfig command. nmcli command: a command line tool to control NetworkManager and report on network status. nmtui command: a terminal UI application based on Curseses graphics that interacts with NetworkManager.

以下显示的是我的 Linux 系统中可用网卡的信息。

The following is the information that is available on my Linux system.

1、如何使用 ifconfig 命令启用禁用网卡?

1. How can an ifconfig command be used to enable the disablement of the Internet card?

ifconfig 命令用于配置网卡。

Ifconfig command is used to configure the netcard.

在系统启动过程中如果需要启用网卡,调用的命令就是 ifconfig。ifconfig 可以提供很多网卡的信息。不管我们想修改网卡的什么配置,都可以使用该命令。

If you want to use a web card during system start-up, the command is ifconfig. Ifconfig can provide information about a lot of web cards. Whatever configuration we want to change, you can use the command.

ifconfig 的常用语法:

The usual terminologies for ifconfig:

执行以下命令禁用 网卡。注意,这里你需要输入你自己的网卡名字。

Execute the following command to disable the net card. Attention, here you need to enter your own card name.

从以下输出结果可以看到网卡已经被禁用了。

The following output shows that the net card has been disabled.

执行以下命令启用 网卡。

Enables the net card with the following command.

从以下输出结果可以看到网卡已经启用了。

The following output shows that the net card has been enabled.

2、如何使用 ifdown/up 命令启用禁用网卡?

2. How to use an ifdown/up command to enable the disablement of the Internet card?

ifdown 命令用于禁用网卡,ifup 命令用于启用网卡。

Ifdown command is used to disable the netcard and ifup command is used to enable the netcard.

注意:这两个命令不支持以 命名的新的网络设备。

Note: These two commands do not support new network devices named after them.

ifdown/ifup 的常用语法:

The usual terminologies for ifdown/ifup:

执行以下命令禁用 网卡。

Execute the following command to disable the net card.

从以下输出结果可以看到网卡已经被禁用了。

The following output shows that the net card has been disabled.

执行以下命令启用 网卡。

Enables the net card with the following command.

从以下输出结果可以看到网卡已经启用了。

The following output shows that the net card has been enabled.

ifup 和 ifdown 不支持以 命名的网卡。当执行该命令时得到的结果如下:

Ifup and ifdown do not support a network card named after it. The results obtained when executing the command are as follows:

3、如何使用 ip 命令启用禁用网卡?

3. How to use an ip command to enable the disablement of the netcard?

ip 命令用于管理网卡,用于替代老旧的、不推荐使用的 ifconfig 命令。

ip command is used to manage web cards and to replace old, non-recommended ifconfig commands.

它和 ifconfig 命令很相似,但是提供了很多 ifconfig 命令不具有的强大的特性。

It is very similar to the ifconfig command, but it provides many powerful features that the ifconfig command does not possess.

ip 的常用语法:

Common terminologies for ip:

执行以下命令禁用 网卡。

Execute the following command to disable the net card.

从以下输出结果可以看到网卡已经被禁用了。

The following output shows that the net card has been disabled.

从以下输出结果可以看到网卡已经启用了。

The following output shows that the net card has been enabled.

4、如何使用 nmcli 命令启用禁用网卡?

4. How can a nmcli command be used to enable the disablement of the Internet card?

nmcli 是一个控制 NetworkManager 并报告网络状态的命令行工具。

nmcli is a command line tool to control NetworkManager and report on network status.

nmcli 可以用做 nm-applet 或者其他图形化客户端的替代品。它可以用于展示、创建、修改、删除、启用和停用网络连接。除此之后,它还可以用来管理和展示网络设备状态。

nmcli can be used to make nm-applet or other graphical client alternatives. It can be used to display, create, modify, delete, enable and disable network connections. It can then also be used to manage and display network device status.

nmcli 命令大部分情况下都是使用“配置名称”工作而不是“设备名称”。所以,执行以下命令,获取网卡对应的配置名称。(LCTT 译注:在使用 nmtui 或者 nmcli 管理网络连接的时候,可以为网络连接配置一个名称,就是这里提到的配置名称Profile name`)

The nmcli command mostly works with " configuration name " instead of " device name ". So, do the following command and get the configuration name for the network card. (LCTT translation: When using nmtui or nmcli to manage network connection, you can configure a name for network connection, which is the configuration name "Profile name" referred to here.)

nmcli 的常用语法:

Common terminologies for nmcli:

执行以下命令禁用 网卡。在禁用网卡的时候,你需要使用配置名称而不是设备名称。

Execute the following command to disable the net card. When you disable the net card, you need to use a configuration name instead of a device name.

从以下输出结果可以看到网卡已经禁用了。

The following output shows that the net card has been disabled.

执行以下命令启用 网卡。同样的,这里你需要使用配置名称而不是设备名称。

Execute the following command to enable the net card. Similarly, you need to use a configuration name instead of a device name.

从以下输出结果可以看到网卡已经启用了。

The following output shows that the net card has been enabled.

5、如何使用 nmtui 命令启用禁用网卡?

5. How can a nmtui command be used to enable the disablement of a net card?

nmtui 是一个与 NetworkManager 交互的、基于 curses 图形库的终端 UI 应用。

nmtui is a terminal UI application that interacts with NetworkManager and is based on the curses graphic library.

在启用 nmtui 的时候,如果第一个参数没有特别指定,它会引导用户选择对应的操作去执行。

When the nmtui is enabled, if the first parameter is not specified, it guides the user to select the corresponding operation for execution.

执行以下命令打开 界面。选择 “Active a connection” 然后点击 “OK”。

Execute the following command to open the interface. Select "Active a connection" and click "OK".


选择你要禁用的网卡,然后点击 “Deactivate” 按钮,就可以将网卡禁用。

Select the card that you want to disable, and then click on the "Deactivate" button to disable the card.


如果要启用网卡,使用上述同样的步骤即可。

If a web card is enabled, the same steps can be used as described above.


via: https://www.2daygeek.com/enable-disable-up-down-nic-network-interface-port-linux-using-ifconfig-ifdown-ifup-ip-nmcli-nmtui/

作者:Magesh Maruthamuthu 选题:lujun9972 译者:bodhix 校对:wxy

@MageshMaruthamuthu: lujun9972: Bodhix proofread: wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

This post was originally edited by LCTT, Linux China.

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=68341

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友