當CentOS7進行最小化安裝時,有不少工具包是沒有的。git
[root@vultr ~]# ifconfig
-bash: ifconfig: command not found
[root@vultr ~]# netstat
-bash: netstat: command not found
咱們常常會使用到的命令,ifconfig、netstat等都沒有。由於缺失了net-tools包。web
[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等網絡相關的命令便能使用了。bash