CentOS 7迷你安裝後找不到‘ifconfig’命令——修複小提示

來源:互聯網
上載者:User

標籤:

就像我們所知道的,“ifconfig”命令用於配置GNU/Linux系統的網路介面。它顯示網路介面卡的詳細資料,包括IP地址,MAC地址,以及網路介面卡狀態之類。但是,該命令已經過時了,而且在最小化版本的RHEL 7以及它的複製版本CentOS 7,Oracle Linux 7和Scientific Linux 7中也找不到該命令。

 

在CentOS最小化伺服器版本中如何尋找網卡IP和其它詳細資料?

 

CentOS 7最小化系統,使用“ip addr”和“ip link”命令來尋找網卡詳情。要知道統計資料,可以使用“ip -s link”。

要查看網卡細節,輸入以下命令:

ip addr

輸出範例:

1:  lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00    inet 127.0.0.1/8 scope host lo    inet6 ::1/128 scope host    valid_lft forever preferred_lft forever2:  venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN    link/void    inet 127.0.0.1/32 scope host venet0    inet 192.168.1.101/32 brd 192.168.1.101 scope global venet0:0

 

要查看網路介面統計資料,輸入命令:

  1. ip link

輸出範例:

1:  lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:002:  venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT    link/void

或者

ip -s link

輸出範例:

1:  lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00    RX: bytes packets errors dropped overrun mcast    0 0 0 0 0 0    TX: bytes packets errors dropped carrier collsns0 0 0 0 0 02:  venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT    link/void    RX: bytes packets errors dropped overrun mcast    8515667 6667 0 0 0 0    TX: bytes packets errors dropped carrier collsns    300403 4249 0 0 0 0

 

在CentOS 7最小化伺服器版本中如何啟用並使用“ifconfig”命令?

如果你不知道在哪裡可以找到ifconfig命令,請按照以下簡單的步驟來找到它。首先,讓我們找出哪個包提供了ifconfig命令。要完成這項任務,輸入以下命令:

yum provides ifconfig

輸出範例:

Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: centos.aol.in* extras: centos.aol.in* updates: centos.aol.innet-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking toolsRepo : @baseMatched from:Filename : /usr/sbin/ifconfig

或者你也可以使用以下命令。

yum whatprovides ifconfig

這裡,“provides”或者“whatprovides”開關用於找出某個包提供了某些功能或檔案。

就像你在上面的輸出中所看到的,net-tools包提供了ifconfig命令。因此,讓我們安裝net-tools包來使用ifconfig命令。

yum install net-tools

現在,你就可以像以往一樣使用ifconfig命令了。

ifconfig -a

輸出範例:

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 0 (Local Loopback)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500inet 127.0.0.1 netmask 255.255.255.255 broadcast 0.0.0.0 destination 127.0.0.1unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)RX packets 7073 bytes 8549159 (8.1 MiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 4611 bytes 359201 (350.7 KiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500inet 192.168.1.101 netmask 255.255.255.255 broadcast 192.168.1.101 destination 192.168.1.101unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)

 

CentOS 7迷你安裝後找不到‘ifconfig’命令——修複小提示

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.