配置虚拟机
使用Hyper-V系统,配置情况如图:
虚拟机网络设置
安装完成后,需要对网卡进行配置,设置好IP地址后才能正常访问网络。
配置步骤如下:
1,首先启动网络服务
[root@DESKTOP-2OBNAL9 ~]# service network start
1,查看当前网卡配置信息
[root@DESKTOP-2OBNAL9 ~]# ip addr
2,进行网卡配置文件目录
[root@DESKTOP-2OBNAL9 ~]# cd /etc/sysconfig/network-scripts/
3,找到网卡配置文件
[root@DESKTOP-2OBNAL9 network-scripts]# ls
ifcfg-eth0
4,使用vi编辑配置文件
[root@DESKTOP-2OBNAL9 network-scripts]# vi ifcfg-eth0
5,更改以下内容
BOOTPROTO=dhcp 改为 static
ONBOOT=no 改为 yes
添加
IPADDR=192.168.2.120
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
DNS1=114.114.114.114
esc SHFIT+: wq
6,修改完成,重启网络服务
[root@DESKTOP-2OBNAL9 network-scripts]# service network restart
7,测试
[root@DESKTOP-2OBNAL9 network-scripts]# ping www.baidu.com
结果如下