虚拟机添加网卡
1,NAT模式默认网卡
编辑=》虚拟网络编辑器
2,添加lan区段网卡
[root@localhost ~]# systemctl restart network [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 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 qlen 1000 link/ether 00:0c:29:28:16:10 brd ff:ff:ff:ff:ff:ff inet 10.1.1.168/24 brd 10.1.1.255 scope global ens33 valid_lft forever preferred_lft forever inet6 fe80::2a7:1ef3:c2a:f37c/64 scope link valid_lft forever preferred_lft forever 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000 link/ether 52:54:00:15:59:51 brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000 link/ether 52:54:00:15:59:51 brd ff:ff:ff:ff:ff:ff 5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 100 link/none inet 10.8.0.1/24 brd 10.8.0.255 scope global tun0 valid_lft forever preferred_lft forever inet6 fe80::3f37:8ce1:9aac:888b/64 scope link flags 800 valid_lft forever preferred_lft forever 6: ens36: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:28:16:1a brd ff:ff:ff:ff:ff:ff inet6 fe80::204f:d979:fe1d:4a15/64 scope link valid_lft forever preferred_lft forever
发现出现新的一张网卡ens36 但是没有网络信息,。进入【cd /etc/sysconfig/network-scripts】目录中,也没有ens36的配置文件。复制ens33的网络配置文件,并进行修改。【cp ifcfg-eth0 ifcfg-eth1】
cd /etc/sysconfig/network-scripts cp ifcfg-ens33 ifcfg-ens36 [root@localhost network-scripts]# cat ifcfg-ens36 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no 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=ens36 UUID=c7c64254-c4d2-4784-a1d6-d573136ab651 ##uuid随便改个数字不重复即可 DEVICE=ens36 ONBOOT=yes IPADDR=172.16.1.168 NETMASK=255.255.255.0 GATEWAY=172.16.1.0 DNS1=8.8.8.8 PREFIX=24
systemctl restart network
安装系统 修改网课名字ens33-》eth0 eth1......
安装界面 选择install centos 7 按tab键 在最后输入 net.ifnames=0 biosdevname=0
本文来自博客园,作者:孙龙-程序员,转载请注明原文链接:https://www.cnblogs.com/sunlong88/p/16886265.html