perl生成随机IP

perl生成随机IP

  1. [root@Centos perl]# perl -e 'printf "%vd\n",pack "N",rand 256**4'
  2. 52.69.62.233
  3.  
  4. [root@Centos perl]# perl -le '$,=".";print map int rand 256,1..4'
  5. 127.47.151.116
  6.  
  7. [root@Centos perl]# perl -le '$,=".";print map int rand 256,1..4'
  8. 4.155.141.148

shell bash生成随机IP

  1. [root@Centos perl]# echo $((RANDOM%256)).$((RANDOM%256)).$((RANDOM%256)).$((RANDOM%256))
  2. 36.250.143.188
1 1