1

KVM中网卡地址随机生成方法

 8 months ago
source link: https://bajie.dev/posts/20240109-kvm_random_mac/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

KVM中网卡地址随机生成方法

2024-01-09 1 分钟阅读

用bash随机生成网卡地址:

echo 52:54:$(dd if=/dev/urandom count=1 2>/dev/null | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4/')  
52:54:f6:65:52:39  

另一种做法:

openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'  

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK