迷你版的centOS 7 Minimal ISO Install
CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。
今天为了在linux上学习python 就在虚拟机上安装了一个minimal CentOS,不过在安装成功后ifconfig命令不能使用,后来使用的ip addr命令获取的。然后连接到了xshell 上,那么问题来了,有了ip addr 命令 还用使用 ifconfig命令吗?
ip addr add和ifconfig的区别,可以参考Bomb250大牛的这篇博文: 从ip addr add和ifconfig的区别看linux网卡ip地址的结构
在这个问题上了解到了,ip 命令的使命就是替代 ipconfig 的,ipconfig表示已经过时了。但对于对ipconfig有感情的,还是习惯使用ifconfig命令的,本文章给出解决方案。
具体问题描述
在安装centos 迷你版[ Minimal ISO ][1]之后的第一个问题:[无法使用ifconfig 命令(迷你centOS操作系统:在安装成功后)]centos系统的ip地址怎么获取?如何让系统的ifconfig命令得到识别?
解决方案:
获取ip >>>[ip addr][2]
[root@localhost ~]
1 : lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 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
valid_lft forever preferred_lft forever
inet6 ::1 /128 scope host
valid_lft forever preferred_lft forever
2 : eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link /ether 00 :0c:29 :41 :79 :da brd ff:ff:ff:ff:ff:ff
inet 192.168 .116.132 /24 brd 192.168 .116.255 scope global dynamic eno16777736
valid_lft 1126 sec preferred_lft 1126 sec
inet6 fe80 ::20 c:29 ff:fe41:79 da/64 scope link
valid_lft forever preferred_lft forever
可以进行[xshll][1] 连接了!! 在系统的net-tools包里提供了ifconfig命令,使用yum安装
[root@localhost ~]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte .net
* extras: mirrors.yun -idc.com
* updates: mirrors.yun -idc.com
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x 86_64 0 :2.0 -0.17 .20131004 git.el 7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
net-tools x86_64 2.0 -0.17 .20131004 git.el 7 base 304 k
Transaction Summary
========================================================================================
Install 1 Package
Total download size: 304 k
Installed size: 917 k
Is this ok [y /d/N]: Y
Downloading packages:
warning: /var/cache/yum/x86_64/7 /base/packages/net-tools-2.0 -0.17 .20131004 git.el 7.x 86_64.rpm : Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for net-tools-2.0 -0.17 .20131004 git.el 7.x 86_64.rpm is not installed
net-tools-2.0 -0.17 .20131004 git.el 7.x 86_64.rpm | 304 kB 00 :00 :03
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) <security@centos.org>"
Fingerprint: 6341 ab27 53 d7 8 a78 a7c2 7 bb1 24 c6 a8a7 f4a8 0 eb5
Package : centos-release-7 -2.1511 .el 7.centos .2 .10 .x 86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y /N]: Y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0 -0.17 .20131004 git.el 7.x 86_64 1 /1
Verifying : net-tools-2.0 -0.17 .20131004 git.el 7.x 86_64 1 /1
Installed:
net-tools.x 86_64 0 :2.0 -0.17 .20131004 git.el 7
Complete!
[root@localhost ~]#
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
安装完成后即可使用ifconfig命令
[root@localhost ~]
eno16777736: flags=4163 <UP ,BROADCAST ,RUNNING ,MULTICAST > mtu 1500
inet 192.168 .116.132 netmask 255.255 .255.0 broadcast 192.168 .116.255
inet6 fe80: : 20 c: 29 ff: fe41: 79 da prefixlen 64 scopeid 0x20 <link>
ether 00 : 0c: 29 : 41 : 79 :da txqueuelen 1000 (Ethernet )
RX packets 19591 bytes 22848873 (21.7 MiB )
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6922 bytes 519272 (507.1 KiB )
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 <UP ,LOOPBACK ,RUNNING > mtu 65536
inet 127.0 .0 .1 netmask 255.0 .0 .0
inet6 : : 1 prefixlen 128 scopeid 0x10 <host>
loop txqueuelen 0 (Local Loopback )
RX packets 4 bytes 340 (340.0 B )
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 340 (340.0 B )
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
问题得到解决。
转自:http://blog.csdn.net/qq_29719097/article/details/51526389