一般改为静态ip都是想内网固定ip搭配虚拟机搭测试环境
打开虚拟机的这个路径,ifcf-enp2s0是自己的网卡名称
vi /etc/sysconfig/network-scripts/ifcfg-enp2s0
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no
#默认是开启dhcp,改为static 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=ens33 UUID=4f8e67e6-5026-47dd-88ec-7476d5a64fa2 DEVICE=ens33 #开机自启默认no,改成yes ONBOOT=yes #添加以下四行 IPADDR=192.168.88.87 NETMASK=255.255.255.0 #注意网关要填写正确 GATEWAY=192.168.88.2 DNS1=223.5.5.5
systemctl restart network
[root@localhost ~]# ip a 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:aa:aa:1f brd ff:ff:ff:ff:ff:ff inet 192.168.88.87/24 brd 192.168.88.255 scope global noprefixroute ens33 valid_lft forever preferred_lft forever inet6 fe80::ca7e:8f4b:b933:ba90/64 scope link noprefixroute valid_lft forever preferred_lft forever
标签:forever,ff,ip,虚拟机,00,lft,NAT,yes From: https://www.cnblogs.com/yuan9910/p/16876343.html