VMware克隆多个服务器并配置不同的ip
- 右键,管理,克隆
-
创建完整克隆
-
名称、位置
-
修改ip:编辑,虚拟网络编辑器,取消勾选
-
启动虚拟机
# 配置网卡
cd /etc/sysconfig/network-scripts/
vi ifcfg-ens33
# 修改为如下
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.128.80 # 设置IP地址3-254,若要和之前的服务器同时启动,需配置不同的ip
NETMASK=255.255.255.0 # 子网掩码
GATEWAY=192.168.128.2 # 设置网关
# 重启生效
service network restart
# 查看ip
ip a
# 测试外网
ping www.baidu.com
# 宿主机上打开cmd测试连接
C:\Users\ychen>ssh -p 22 root@192.168.128.80
The authenticity of host '192.168.128.80 (192.168.128.80)' can't be established.
ECDSA key fingerprint is SHA256:RxjENmy1AZcImPSS3Z2AAgkJVppRKLmNENOl+SK2STo.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.128.80' (ECDSA) to the list of known hosts.
root@192.168.128.80's password:
Last login: Sun Dec 3 06:16:10 2023
[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:ec:de:ea brd ff:ff:ff:ff:ff:ff
inet 192.168.128.80/24 brd 192.168.128.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::7be1:62e0:eafc:e385/64 scope link noprefixroute
valid_lft forever preferred_lft forever
- 修改hosts
vim /etc/hosts
192.168.128.80 node1
# 命令行显示
[root@node1 ~]#