change the local ip on the cloned machine via qm

vipTelnet

New Member
Mar 20, 2021
12
2
3
41
There is no problem with cloning templates, this is done by the command
qm clone 252 1003 --name 3
And then after coning, I wanted to change the ip
qm set 1003 --ipconfig0 ip=192.168.0.3/24,gw=192.168.0.1
See response
update VM 1003: -ipconfig0 ip=192.168.0.3/24,gw=192.168.0.1
I reboot VM 1003 and nothing happens
ip address on VM 1003 remained the same

The virtual machine is under control Linux alpine 5.10.24-0-lts
the extension is installed on it qemu-guest-agent
 
Last edited:
I managed to solve my problem
I was able to fully automate the process of cloning and changing the local ip address
On the host mashine I run command
for i in `seq 2 200`; do ((y=1000+i)); qm clone 252 $y --name $i; qm start $y; qm wait $y -timeout 10; qm guest exec $y -- bash /root/static_ip.sh $i; done
File contents static_ip.sh
Bash:
#!/bin/bash

echo $1
cd /etc/network/
sed -i "s/192.168.0.253/192.168.0.$1/g" "interfaces"
reboot

Yes, I realized that I am using a function "qm wait" that is not assigned.
But its function of delay before execution qm guest exec, it performs
 
Last edited:
  • Like
Reactions: Datenfalke

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!