使用Virtulbox安装Centos7
操作小提示
鼠标焦点在宿主机与虚拟机间切换:【右Ctrl】键
网卡配置说明:
1.网卡作用
port id | 连接方式 | 作用 |
---|---|---|
网卡1 | 网络地址转换(NAT) | 负责虚拟机访问外网 |
网卡2 | 仅主机(Host-Only)网络 | 负责宿主机远程管理虚拟机 |
2.网卡配置文件
enp0s3网卡配置前:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=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=enp0s3
UUID=f0125686-f767-45b9-9624-8b78fa12e50f
DEVICE=enp0s3
ONBOOT=no //需要修改
操作:
将ONBOOT=no改为ONBOOT=yes
enp0s3网卡配置后:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=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=enp0s3
UUID=f0125686-f767-45b9-9624-8b78fa12e50f
DEVICE=enp0s3
ONBOOT=yes
enp0s8网卡配置前:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
TYPE=Ethernet
BOOTPROTO=dhcp //修改成static
DEFROUTE=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=enp0s8
UUID=06dd06d5-c019-42b6-8764-5a2eb2a488a4
DEVICE=enp0s8
ONBOOT=no //修改为yes
//末尾添加IP地址信息等,见配置后。
enp0s8网卡配置后:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=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=enp0s8
UUID=06dd06d5-c019-42b6-8764-5a2eb2a488a4
DEVICE=enp0s8
ONBOOT=yes
IPADDR=192.168.1.2
NETMASK=255.255.255.0