A direct example of the use of the VI command saves forgetting
To edit the network card configuration file
Vi/etc/sysconfig/network-scripts/ifcfg-enp2s0
I don't know that NIC IP addr command
Ps:centos 7.0 Minimized installation says that you don't have a network connection turned on, and you don't have a switch on the network connection. It's definitely not the one that's installed. Dynamically assign IP when configured to open
Press the I key to enter edit mode the Insert typeface appears at the bottom
Direct keyboard key Move Delete Modify
Change ESC to command mode.
Post the modified file here
[Email protected] ~]# vi/etc/sysconfig/network-scripts/ifcfg-enp2s0hwaddr= "6c:62:6d:73:e6:4a" type= "Ethernet" bootproto= "Static"//static ipdefroute= "yes" peerdns= "yes" peerroutes= "yes" ipv4_failure_fatal= "no" ipv6init= "yes" ipv6_ autoconf= "yes" ipv6_defroute= "yes" ipv6_peerdns= "yes" ipv6_peerroutes= "yes" ipv6_failure_fatal= "no" name= "Enp2s0" Uuid= "Cf6c2da6-7944-4040-9f25-67c4eaf2acae" onboot= "yes"//auto-enable network connection ipaddr0=192.168.1.103//fixed IP add prefixo0=24// Subnet Mask gateway0=192.168.1.1//Gateway dns1=8.8.8.8dns2=8.8.4.4
: wq! Force Save Exit VI
Restart Network
Service Network restart
or reboot directly
Shutdown-r now
View after restarting login
IP addr
View Extranet IP
Curl Ifconfig.me
CentOS 7.0VI command and fixed intranet IP