VMware Workstation 下的 CentOS 使用固定 IP

简略写下,有空补充详细。

VMware Workstation

image-20200913205506776

windows

find the VMware Workstation NAT Network Adapter, then change the IPV4 config:

image-20200913205419340

CentOS network config

1
sudo vi /etc/sysconfig/network-scripts/ifcfg-ens33

content:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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=ens33
UUID=7ef0da97-7e3f-4052-85e5-e90c8386167f
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.11.6
GATEWAY=192.168.11.2
NETMASK=255.255.255.0
DNS1=192.168.11.2

network.service isn't available on CentOS8 by default, so we should use NetworkManager.service and restart it:

1
2
3
sudo systemctl restart NetworkManager
# or use the below command:
# sudo nmcli connection reload

Check either IP is changed:

1
ip addr

output:

image-20200913210218875

done!

updatedupdated2021-01-052021-01-05
加载评论