CentOS7 is a solution for minimizing the absence of the ifconfig command after installation
A few days ago, I installed CentOS7 at a minimum. I found that the network configuration of ifconfig was not found in the system and I was eager to access the Internet. What should I do. The solution is as follows:
1. Use the optical drive to configure the yum source and install the net-tools Package (or use the rpm command ).
1.1. Move the default CentOS yum source division (CentOS-Media.repo) to a specified directory. I created a subdirectory named repo in the yum source configuration file storage, perform the following operations:
[Root @ bogon ~] # Cd/etc/yum. repos. d/
[Root @ bogon yum. repos. d] # ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentO CentOS-fasttrack.repo S-Media.repo CentOS-Sources.repo
[Root @ bogon yum. repos. d] # mkdir repo
[Root @ bogon yum. repos. d] # ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo repo
[Root @ bogon yum. repos. d] # mv *. repo/
[Root @ bogon yum. repos. d] # ls
Repo
[Root @ bogon yum. repos. d] # cd repo/
[Root @ bogon repo] # ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentO CentOS-fasttrack.repo S-Media.repo CentOS-Sources.repo
[Root @ bogon repo] # Music CentOS-Media.repo ../
[Root @ bogon repo] # ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentO CentOS-fasttrack.repo S-Sources.repo
[Root @ bogon repo] # cd ..
[Root @ bogon yum. repos. d] # ls
CentOS-Media.repo repo
1.2 perform the following steps to attach the optical drive to configure the yum Source:
[Root @ bogon yum. repos. d] # mount/dev/sr0/media/
Mount:/dev/sr0 is write-protected, mounting read-only
# The commands and operation steps for mounting the optical drive
[Root @ bogon yum. repos. d] # cat CentOS-Media.repo
C7-media
Name = CentOS-$ releasever-Media
Baseurl = file: // media/
Gpgcheck = 1
Enabled = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# The configuration document of the above optical drive yum Source
[Root @ bogon yum. repos. d] # yum list | wc-l
3776
# Use yum list to check whether the yum source has any problems
1.3 install the net-tools toolkit with yum
[Root @ bogon yum. repos. d] # yum install net-tools-y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0: 2. 0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution
............
Running transaction
Installing: net-tools-2.0-0.17.20131004git.el7.x86_64 1/1
Verifying: net-tools-2.0-0.17.20131004git.el7.x86_64 1/1
Installed:
Net-tools.x86_64 0: 2. 0-0.17.20131004git.el7
Complete!
1.4 test the ifconfig command
[Root @ bogon yum. repos. d] # ifconfig
Eno16777736: flags = 4163 <UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
Inet 192.168.1.131 netmask 255.255.255.0 broadcast 192.168.1.255
Inet6 fe80: 20c: 29ff: fe2d: c130 prefixlen 64 scopeid 0x20 <link>
Ether 00: 0c: 29: 2d: c1: 30 txqueuelen 1000 (Ethernet)
RX packets 53366 bytes 3890372 (3.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 47832 bytes 22949340 (21.8 MiB)
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 Loop txqueuelen 0 (Local Loopback)
RX packets 58 bytes 5088 (4.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 58 bytes 5088 (4.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2. in linux, in addition to the ifconfig command, you can configure the ip address. In addition, you can also use the ip address command (this method is used ).
[Root @ bogon yum. repos. d] # ip addr l eno16777736
2: eno16777736: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
Link/ether 00: 0c: 29: 2d: c1: 30 brd ff: ff
Inet 192.168.1.131/24 brd 192.168.1.255 scope global eno16777736
Valid_lft forever preferred_lft forever
Inet6 fe80: 20c: 29ff: fe2d: c130/64 scope link
Valid_lft forever preferred_lft forever
[Root @ bogon yum. repos. d] # ip addr add 192.168.1.131/24 dev eno16777736
The ip address command is not a one-or-Two Sentence explanation. In the future, I will give you a detailed explanation about network interfaces, after CentOS7, the default Nic type identifier is eno16777736, and ethN is used in the previous system.
This article permanently updates the link address: