Details of CentOS common network settings

Time:2020-2-11

Shutdown – h now

Reboot: Reboot

Network settings:VI / etc / sysconfig / network sripts / ifcfg-eth0 񖓿 set network connection type, IP, gateway, subnet mask

VI / etc / sysconfig / network

VI / etc / resolv.conf ා set DNS

After setting service network restart, restart the network service

Virtual machine network settings:

Method 1:Using bridge, set IP (the same network segment as the host), subnet mask (255.255.255.0), gateway (the same as the host) in / etc / sysconfig / network sripts / ifcfg-eth0, open onboot = yes, and set bootproto = static. Other fixed, can realize host and virtual machine two-way access.

Mode two:Use the network address translation NAT, set bootproto = DHCP in / etc / sysconfig / network sripts / ifcfg-eth0, open onboot = yes, and other settings are not required to share the host network to access the Internet. When the host uses wired network, the virtual machine can access the host, and the host cannot access the virtual machine. When the host uses WiFi network, the virtual machine and the host can be accessed in two directions.

/No need to set in etc / sysconfig / network

/The DNS address in etc / resolv.conf will be obtained automatically, which is consistent with that of the host