CentOS 7 configures Oracle VM and host network, notes on hand - continuous update~

Keywords: network CentOS Linux

CentOS 7
----
Recently, I have reinstalled the virtual machine Linux, and I will take some practical notes. The following is a guide for pit arrangement:

For initial installation, configure the network card and virtual machine host network first.
To view network card details, enter the following command:

ifconfig
ip addr
ip link


Configure the CentOS7 virtual machine to be able to connect to the Internet, and the host and CentOS7 virtual machine can also be connected
1. Configure static ip

[root@root ~]# cd ../etc/sysconfig/network-scripts/
[root@root network-scripts]# vi ifcfg-enp0s3 

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#BOOTPROTO=dhcp
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=1d9b1aac-2e87-49d6-bd5e-b5aab318eff7
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.0.100
NETMASK=255.255.255.0

2. Configure the connection mode of virtual machine network card

3. Test network

[root@root ~]# cd ../etc/sysconfig/network-scripts/
[root@root network-scripts]# vi ifcfg-enp0s3 
[root@root network-scripts]# service network restart
Restarting network (via systemctl):                        [  Determine  ]
[root@root network-scripts]# ping www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=54 time=15.4 ms
^C
--- www.a.shifen.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 15.493/15.493/15.493/0.000 ms
[root@root network-scripts]# ping 192.168.0.4
PING 192.168.0.4 (192.168.0.4) 56(84) bytes of data.
64 bytes from 192.168.0.4: icmp_seq=1 ttl=128 time=0.284 ms
^C
--- 192.168.0.4 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.284/0.284/0.284/0.000 ms
[root@root network-scripts]# 

Solve the problem of network communication.
Restart and run silently in the background.

Xsehll connection~
------

Posted by Garethp on Tue, 24 Dec 2019 06:42:10 -0800