CentOS 7.2最小安装后不能使用ifconfig,netstat等命令是因为默认没有安装net-tools包,安装好CentOS 7.2后连接网络,通过默认的yum源可以安装net-tools包,就可以使用上述命令了。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
root@Slave02 ~]# ifconfig
-bash: ifconfig: command
not
found
[root@Slave02 ~]# ip add show
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0:
link/ether fa:16:3e:41:78:4e brd ff:ff:ff:ff:ff:ff
inet 10.128.71.238/24 brd 10.128.71.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::4130:c2bc:434f:5e29/64 scope link
valid_lft forever preferred_lft forever
3: eth1:
link/ether fa:16:3e:03:4f:42 brd ff:ff:ff:ff:ff:ff
[root@Slave02 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
[root@Slave02 ~]# systemctl restart network.service
[root@Slave02 ~]# yum -y install net-tools
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): updates/7/x86_64/primary_db | 3.6 MB 00:00:00
(2/4): extras/7/x86_64/primary_db | 130 kB 00:00:00
(3/4): base/7/x86_64/group_gz | 156 kB 00:00:01
(4/4): base/7/x86_64/primary_db | 5.7 MB 00:00:08
Determining fastest mirrors
* base: mirrors.cn99.com
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Installing:
net-tools x86_64 2.0-0.22.20131004git.el7 base 305 k
Transaction Summary
======================================================================================================================================
Install 1 Package
Total download size: 305 k
Installed size: 917 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/net-tools-2.0-0.22.20131004git.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for net-tools-2.0-0.22.20131004git.el7.x86_64.rpm is
not
installed
net-tools-2.0-0.22.20131004git.el7.x86_64.rpm | 305 kB 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid :
"CentOS-7 Key (CentOS 7 Official Signing Key)
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1
Verifying : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1
Installed:
net-tools.x86_64 0:2.0-0.22.20131004git.el7
Complete!
[root@Slave02 ~]# ifconfig
eth0: flags=4163
inet 10.128.71.238 netmask 255.255.255.0 broadcast 10.128.71.255
inet6 fe80::4130:c2bc:434f:5e29 prefixlen 64 scopeid 0x20
ether fa:16:3e:41:78:4e txqueuelen 1000 (Ethernet)
RX packets 13174 bytes 1492282 (1.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 393 bytes 63067 (61.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163
inet 192.168.20.238 netmask 255.255.255.0 broadcast 192.168.20.255
inet6 fe80::5a63:7ec4:60ee:3a0 prefixlen 64 scopeid 0x20
ether fa:16:3e:03:4f:42 txqueuelen 1000 (Ethernet)
RX packets 15654 bytes 11702290 (11.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4383 bytes 328314 (320.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 408 bytes 32936 (32.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 408 bytes 32936 (32.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
本文转自lq201151CTO博客,原文链接:http://blog.51cto.com/liuqun/1983687 ,如需转载请自行联系原作者
[root@Slave02 ~]#
|