ipv6privateloopback.sh
· 363 B · Bash
Raw
#!/bin/sh
# Asuming you want to make a random private /120 prefix in IPv6 and have all of those addresses assigned to the loopback interface (dev lo), and you're root, and have https://gitlab.com/ipcalc/ipcalc installed, run:
eval "$(ipcalc -r 120 -np)"
netpref="${NETWORK}/${PREFIX}"
ip addr add "$netpref" dev lo scope host
ip route add local "$netpref" dev lo
1 | #!/bin/sh |
2 | # Asuming you want to make a random private /120 prefix in IPv6 and have all of those addresses assigned to the loopback interface (dev lo), and you're root, and have https://gitlab.com/ipcalc/ipcalc installed, run: |
3 | eval "$(ipcalc -r 120 -np)" |
4 | netpref="${NETWORK}/${PREFIX}" |
5 | ip addr add "$netpref" dev lo scope host |
6 | ip route add local "$netpref" dev lo |
7 |