Help us understand the problem. What is going on with this article?

一枚のNICに大量のIPアドレスを割り当てる

More than 3 years have passed since last update.

ミッション

1000台分の接続テストがしたい。

シェルスクリプト

sample.sh
#!/bin/sh

loop=1
for adr3 in $(seq 30 39)
do
  for adr4 in $(seq 0 99)  
  do
    echo $loop $adr3 $adr4
    ifconfig eth0:$loop 172.21.$adr3.$adr4 netmask 255.255.0.0 up
    loop=`expr $loop + 1`
  done
done

確認

$ ip address show
:
:
    inet 172.21.30.0/16 brd 172.21.255.255 scope global eth0:1
    inet 172.21.30.1/16 brd 172.21.255.255 scope global secondary eth0:2
    inet 172.21.30.2/16 brd 172.21.255.255 scope global secondary eth0:3
    inet 172.21.30.3/16 brd 172.21.255.255 scope global secondary eth0:4
    inet 172.21.30.4/16 brd 172.21.255.255 scope global secondary eth0:5
    inet 172.21.30.5/16 brd 172.21.255.255 scope global secondary eth0:6
    inet 172.21.30.6/16 brd 172.21.255.255 scope global secondary eth0:7
    inet 172.21.30.7/16 brd 172.21.255.255 scope global secondary eth0:8
    inet 172.21.30.8/16 brd 172.21.255.255 scope global secondary eth0:9
    inet 172.21.30.9/16 brd 172.21.255.255 scope global secondary eth0:10
    inet 172.21.30.10/16 brd 172.21.255.255 scope global secondary eth0:11
    inet 172.21.30.11/16 brd 172.21.255.255 scope global secondary eth0:12
    inet 172.21.30.12/16 brd 172.21.255.255 scope global secondary eth0:13
:
:
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away