the hoster issued a subnet 2a05: fb40: 5 :: / 48, in this network 65000 networks with a mask / 64
Accordingly, two questions are of interest:
- how to generate 5-6 IPv6 from all 65000 subnets.
- in what format and where to add the resulting ip.
two sub-questions:
you can get a list of hexadecimal numbers from 0001 to ffff , for example, like this:
$ for i in $(seq 1 65535); do printf '%04x\n' $i; done ip-addresses are assigned to the specified network interface by the ip program:
$ sudo ip address add ip-адрес/маска dev интерфейс (and address and add can be abbreviated to one letter: ip aa ... )
deleted in the same way:
$ sudo ip address del ip-адрес/маска dev интерфейс ( del here can also be reduced to one letter ip ad ... )
combining them together, we get something like:
#!/bin/bash prefix="2a05:fb40:5:" mask=64 addrs="1 2 3 4 5" interface="eth0" for i in $(seq 1 65535); do for j in $addrs; do a=$(printf '%s%04x::%s/%s' $prefix $i $j $mask) ip aa $a dev $interface done done run the script (by assigning the executable bit to the file) as root user :
$ sudo /путь/к/этому/скрипту they will be generated and executed this type of command:
ip aa 2a05:fb40:5:0001::1/64 dev eth0 ip aa 2a05:fb40:5:0001::2/64 dev eth0 ip aa 2a05:fb40:5:0001::3/64 dev eth0 ip aa 2a05:fb40:5:0001::4/64 dev eth0 ip aa 2a05:fb40:5:0001::5/64 dev eth0 ip aa 2a05:fb40:5:0002::1/64 dev eth0 ip aa 2a05:fb40:5:0002::2/64 dev eth0 ip aa 2a05:fb40:5:0002::3/64 dev eth0 ip aa 2a05:fb40:5:0002::4/64 dev eth0 ip aa 2a05:fb40:5:0002::5/64 dev eth0 ... but I personally would not dare to launch it - an attempt to fix this huge number of addresses (and automatically added routes — one for each address) - 5*65535=327675 - is quite likely to soon exceed any limits of the network subsystem of the linux program, which may lead to a system reboot (or require it to restore normal operation).
Source: https://ru.stackoverflow.com/questions/540608/
All Articles