Linux ifconfig is a network management tool that helps you to check the IP addresses of Linux systems as well as configure network interfaces. Let’s dive in and see how this popular command is used.
Linux ifconfig是一種網絡管理工具,可幫助您檢查Linux系統的IP地址以及配置網絡接口。 讓我們深入看看如何使用此流行命令。
The ifconfig command without any arguments displays the status of all the network interfaces associated with the Linux system.
linux ifconfig命令、 不帶任何參數的ifconfig命令顯示與Linux系統關聯的所有網絡接口的狀態。
$ ifconfig
Sample Output
樣本輸出
To display ifconfig output in short format use the -s
option.
centos沒有ifconfig命令? 要以短格式顯示ifconfig輸出,請使用-s
選項。
$ ifconfig -s
Sample output
樣品輸出
If you want to check the status of a specific network interface, use the syntax:
centos ifconfig、 如果要檢查特定網絡接口的狀態,請使用以下語法:
$ ifconfig [interface_name]
For instance, to display the status of interface enp0s3
, run:
例如,要顯示接口enp0s3
的狀態,請運行:
$ ifconfig enp0s3
Sometimes, you may want to reset your network interfaces. Linux ifconfig command can be used to disable or bring up network interfaces.
centos安裝ifconfig命令, 有時,您可能想重置網絡接口。 Linux ifconfig命令可用于禁用或啟動網絡接口。
To bring down a network interface, run the command
要關閉網絡接口,請運行以下命令
$ ifconfig [interface_name] down
For example, to bring down interface enp0s3
execute the command:
ifconfig命令安裝、 例如,要關閉接口enp0s3
執行以下命令:
$ ifconfig enp0s3 down
when you check the statistics using the ifconfig
command, the disabled interface will not appear in the output. For example, the enp0s3
interface will not be displayed.
使用ifconfig
命令檢查統計信息時,禁用的接口將不會出現在輸出中。 例如,將不會顯示enp0s3
界面。
To bring the interface up execute:
linux curl命令。 要調出接口,請執行:
$ ifconfig enp0s3 up
This time, round, the interface will show up upon running the ifconfig
command.
這次,該界面將在運行ifconfig
命令時顯示。
Sample output
chkconfig命令、 樣品輸出
Using the ifconfig command, you can view all interfaces whether they are up or down. To do this, use the -a
option as shown
使用ifconfig命令,您可以查看所有接口的狀態,無論它們是打開還是關閉。 為此,請使用-a
選項,如圖所示
$ ifconfig -a
Sample output
ifconfig, 樣品輸出
Promiscuous mode refers to an operational mode that allows a network adapter to access and view all packets in a network. In this mode, the adapter does not filter packets.
混雜模式是指允許網絡適配器訪問和查看網絡中所有數據包的操作模式。 在這種模式下,適配器不過濾數據包。
To enable promiscuous mode use the syntax:
linux中沒有ifconfig, 要啟用混雜模式,請使用以下語法:
$ ifconfig [network_interface] promisc
For example:
例如:
$ ifconfig enp0s3 promisc
To disable promiscuous mode execute:
要禁用混雜模式,請執行:
$ ifconfig enp0s3 -promisc
Sample output
樣品輸出
Linux ifconfig command can also be used to temporarily configure the IP address and netmask of a network adapter. The syntax is as shown:
Linux ifconfig命令還可用于臨時配置網絡適配器的IP地址和網絡掩碼。 語法如下所示:
$ ifconfig [network_interface] [IP-address] netmask [subnet mask]
For instance,
例如,
$ ifconfig enp0s3 192.168.43.100 netmask 255.255.255.0
You can later confirm this using the ifconfig
command.
您以后可以使用ifconfig
命令確認這一點。
You can change mtu (Maximum Transmission Unit) value using the syntax:
您可以使用以下語法更改mtu(最大傳輸單位)值:
$ ifconfig [interface_name] mtu [mtu-value]
For instance:
例如:
$ ifconfig enp0s3 mtu 800
These are some of the most commonly used ifconfig
commands. Your feedback on this guide is most welcome.
這些是一些最常用的ifconfig
命令。 非常歡迎您對本指南提供反饋。
翻譯自: https://www.journaldev.com/30052/linux-ifconfig-command-examples
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态