1、查看网卡
此处网卡名称为ens33
[root@localhost ~]# ip addr
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:e1:40:49 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.107/24 brd 192.168.1.255 scope global noprefixroute dynamic ens33
valid_lft 5744sec preferred_lft 5744sec
inet6 fe80::4f6e:679d:1701:cef9/64 scope link noprefixroute
valid_lft forever preferred_lft forever
2、修改配置文件
把ONBOOT改为yes
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
1 TYPE=Ethernet
2 PROXY_METHOD=none
3 BROWSER_ONLY=no
4 BOOTPROTO=dhcp
5 DEFROUTE=yes
6 IPV4_FAILURE_FATAL=no
7 IPV6INIT=yes
8 IPV6_AUTOCONF=yes
9 IPV6_DEFROUTE=yes
10 IPV6_FAILURE_FATAL=no
11 IPV6_ADDR_GEN_MODE=stable-privacy
12 NAME=ens33
13 UUID=953801cc-367c-4bb0-af20-16efaf6c0b61
14 DEVICE=ens33
15 ONBOOT=yes
3、在虚拟机上设置网络连接为桥接模式并勾选复制物理网络连接状态
4、安装ifconfig
yum-y install net-tools