帮酷LOGO
0 0 评论
文章标签:添加  SED  mac-addr  Mac地址  随机  mac  ECHO  rand  

生成随机有效的mac地址

for i in {0..1200}; do for i in {1..12} ; do echo -n ${hexchars:$(( $RANDOM % 16 )):1} ; done | sed -e 's/(..)/:1/g' | sed 's/.(.*)/1/' ; echo; done
首先设置变量$hexchars: hexchars="0123456789ABCDEF"如果需要少于1200个的mac地址,则更改第一个for循环中的数字,
示例输出
57:46:94:C4:2E:8C
81:03:BA:C0:69:F2
58:1D:AB:FE:BC:70
C6:1F:49:58:9B:94
17:6B:BF:8D:C5:E8
BA:0E:9A:0F:BA:B6
54:45:62:93:C3:46
2B:A8:0E:04:4E:39
47:3E:B0:63:72:AE
42:E9:EE:AA:EC:E7
76:B3:60:0F:B9:AA
C4:33:DB:6B:55:71
A1:CE:52:15:9B:4E


文章标签:添加  mac  ECHO  rand  随机  mac-addr  Mac地址  SED  

Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语