Configure IP addresses in centos 7
Environment
Virtual Machine: VMWare10.0.1 build-1379776
Operating System: 64-bit CentOS7
Introduction
CentOS7 Minimal installation (Minimal) without the ifconfig command, which can be installed in the net-tools Package through yum, but when our network is not configured, at this time, yum cannot work (cannot be connected to the network to download software packages ). Then we need to manually configure Nic settings.
View network adapters
ip a
Lists information about all network adapters.
Lo is the local loopback address 127.0.0.1
Eno16777736 is our VM Nic.
Configure IP addresses
Open/etc/sysconfig/network-scripts/ifcfg-eno16777736
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
Default Configuration
Modify configurations
Description
IPV6INIT = no # Disable ipv6
ONBOOT = yes # Start automatic loading
HWADDR = 00: 0C: 29: C7: A9: 5D # enter the MAC address based on the virtual machine network adapter Configuration
PREFIX = 24 # Mask Length
Complete configuration file
TYPE=EthernetBOOTPROTO=noneDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=noIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noNAME=eno16777736UUID=f74f183e-026c-44fd-91f3-08a08a3d02cfDEVICE=eno16777736ONBOOT=yesDNS1=114.114.114.114HWADDR=00:0C:29:C7:A9:5DIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPADDR=10.12.2.68PREFIX=24GATEWAY=10.12.2.254
Restart NETWORK SERVICE
service network restart
Test network, ping Gateway
ping 10.12.2.254
According to the feedback, the network and configuration are completed.