if you are using MicroCloud LXD MicroOVN and MicroCeph. the easiest way to limit instance is to run this command:
# Get Hostname of the Network Interface
lxc config show <instance_name> --expanded | grep host_name
# the Output of the command
volatile.eth0.host_name: tapbc224425
The tapbc224425 are the hostname of the instance network interface.
After that, run this command to limit upload and download speed / bandwidth
# Limit Upload Speed to 10mbps
sudo ovs-vsctl set interface <host_name> ingress_policing_burst=10000
sudo ovs-vsctl set interface <host_name> ingress_policing_rate=10000
# Remove Download Speed Config if any
sudo tc qdisc del dev <host_name> root
# Limit Download Speed to 10mbps
sudo tc qdisc add dev <host_name> root tbf rate 20mbit burst 32kbit latency 50ms
<host_name> with tapbc224425 or your vm instance hostnameSo the final command will look like this
# Limit Upload Speed to 10mbps
sudo ovs-vsctl set interface tapbc224425 ingress_policing_burst=10000
sudo ovs-vsctl set interface tapbc224425 ingress_policing_rate=10000
# Remove Download Speed Config if any
sudo tc qdisc del dev tapbc224425 root
# Limit Download Speed to 10mbps
sudo tc qdisc add dev tapbc224425 root tbf rate 20mbit burst 32kbit latency 50ms
Test the speed or bandwidth of the internet by login to the vm and run speedtest or any speed test network tools