ifconfig,netstat command not found

  当CentOS7进行最小化安装时,有很多工具包是没有的。

[root@vultr ~]# ifconfig
-bash: ifconfig: command not found
[root@vultr ~]# netstat
-bash: netstat: command not found

  我们经常会使用到的命令,ifconfig、netstat等都没有。因为缺失了net-tools包。

[root@vultr ~]# yum install -y net-tools    # 安装net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.wdc1.us.leaseweb.net
 * epel: reflector.westga.edu
 * extras: mirror.vcu.edu
 * updates: ftpmirror.your.org
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.24.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                        Arch                        Version                                          Repository                 Size
=============================================================================================================================================
Installing:
 net-tools                      x86_64                      2.0-0.24.20131004git.el7                         base                      306 k

Transaction Summary
=============================================================================================================================================
Install  1 Package

Total download size: 306 k
Installed size: 918 k
Downloading packages:
net-tools-2.0-0.24.20131004git.el7.x86_64.rpm                                                                         | 306 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.24.20131004git.el7.x86_64                                                                                 1/1 
  Verifying  : net-tools-2.0-0.24.20131004git.el7.x86_64                                                                                 1/1 

Installed:
  net-tools.x86_64 0:2.0-0.24.20131004git.el7                                                                                                

Complete!
[root@vultr ~]# ifconfig | grep inet
        inet 155.138.229.164  netmask 255.255.254.0  broadcast 155.138.229.255
        inet6 fe80::5400:1ff:feff:86b7  prefixlen 64  scopeid 0x20<link>
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
[root@vultr ~]# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2746/sshd           
tcp6       0      0 :::22                   :::*                    LISTEN      2746/sshd           
udp        0      0 0.0.0.0:68              0.0.0.0:*                           3381/dhclient       
udp        0      0 127.0.0.1:323           0.0.0.0:*                           1573/chronyd        
udp6       0      0 ::1:323                 :::*                                1573/chronyd        
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     12953    1/systemd            /run/systemd/private
unix  2      [ ACC ]     STREAM     LISTENING     14775    1/systemd            /run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     7397     1/systemd            /run/systemd/journal/stdout
unix  2      [ ACC ]     SEQPACKET  LISTENING     13039    1/systemd            /run/udev/control

  安装net-tools工具包之后,ifconfig|netstat等网络相关的命令便能使用了。

posted @ 2019-04-18 09:20 starnight_cyber 阅读(...) 评论(...) 编辑 收藏