Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


IPv6 addresses generator?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

IPv6 addresses generator?

Good day.

For the subnet planning i use http://www.gestioip.net/cgi-bin/subnet_calculator.cgi, which is very useful tool. But can you advise me IPv6 addresses generator? Where i can input subnet and get n of random addresses? Can't find it both online and as standalone software.

Thanks!

Thanked by 1licher70

Comments

  • skorupionskorupion Member, Host Rep
    1. Learn to write ipv6 addresses.
    2. It will be as easy as generating random addresses as it's on a /8 in ipv4
  • benj0xbenj0x Member
    edited March 2021

    Look here.

    random-ipv6-addr.py

    #!/usr/bin/env python3
    """
    Generate a random IPv6 address for a specified subnet
    """
    
    from random import seed, getrandbits
    from ipaddress import IPv6Network, IPv6Address
    
    subnet = '2001:db8:100::/64'
    
    seed()
    network = IPv6Network(subnet)
    address = IPv6Address(network.network_address + getrandbits(network.max_prefixlen - network.prefixlen))
    
    print(address)
    

    Source: wido/random-ipv6-addr.py on GitHub

    Simply replace subnet with your wanted subnet.

  • benj0xbenj0x Member
    edited March 2021

    @skorupion said:
    1. Learn to write ipv6 addresses.
    2. It will be as easy as generating random addresses as it's on a /8 in ipv4

    Bulk generation of random IPv6 addresses isn't that easy by hand. Sometimes a script is really handy for this purpose. :smile:

  • or some very quick and nasty php..

  • skorupionskorupion Member, Host Rep

    @benj0x said:

    @skorupion said:
    1. Learn to write ipv6 addresses.
    2. It will be as easy as generating random addresses as it's on a /8 in ipv4

    Bulk generation of random IPv6 addresses isn't that easy by hand. Sometimes a script is really handy for this purpose. :smile:

    Ohh, you don't mean like 10 addresses but hundreds. oki

  • @benj0x said:
    Look here.
    Simply replace subnet with your wanted subnet.

    Yes, i saw it, but the result returns only 1 address. IS it possible for you to explain how to get n addresses in one run? I have no skill to do this. Thanks.

  • @MarshalChe said: Yes, i saw it, but the result returns only 1 address. IS it possible for you to explain how to get n addresses in one run? I have no skill to do this. Thanks.

    #!/usr/bin/env python3
    """
    Generate a random IPv6 address for a specified subnet
    """
    
    from random import seed, getrandbits
    from ipaddress import IPv6Network, IPv6Address
    
    subnet = '2001:db8:100::/64'
    
    for c in range(0, 100):
        seed()
        network = IPv6Network(subnet)
        address = IPv6Address(network.network_address + getrandbits(network.max_prefixlen - network.prefixlen))
    
        print(address)
    

    Just add a simple loop. NOTE Possible duplication of addresses.

    Thanked by 1MarshalChe
  • @MarshalChe said:

    @benj0x said:
    Look here.
    Simply replace subnet with your wanted subnet.

    Yes, i saw it, but the result returns only 1 address. IS it possible for you to explain how to get n addresses in one run? I have no skill to do this. Thanks.

    for i in {1..100}; do python random-ipv6-addr.py; done

    or just look at the answer of Hotmarer

    Thanked by 1MarshalChe
  • RazzaRazza Member

    If you do need a large number use the version posted by @Hotmarer, for loop dose work but it's quite a bit slower since it need to start a new python process for each run.

  • edited March 2021

    This is what I use https://ip6.sh

    Just use the random subnet section and /64 to /128 and generate as many address as you want.

    Thanked by 1MarshalChe
  • @MarshalChe said: But can you advise me IPv6 addresses generator? Where i can input subnet and get n of random addresses?

    Why not just use SLAAC? It's literally built in to the protocol and is probably what your home network is using for IPv6 configuration (if your internet provider has native IPv6)

  • jtkjtk Member
    edited March 2021

    @MarshalChe said:
    Where i can input subnet and get n of random addresses? Can't find it both online and as standalone software.

    Here is the start of your own simple script (on Linux):

    while : ; do head /dev/urandom | md5sum | cut -c1-32 - ; done

    Change 32 to how many ever digits you need, insert a prefix, separate each 4 characters by a colon to get pretty formatting, etc.

  • MarshalCheMarshalChe Member
    edited March 2021

    @Daniel15 said: SLAAC

    @serveradministrator said:
    This is what I use https://ip6.sh

    Just use the random subnet section and /64 to /128 and generate as many address as you want.

    This is what i searched for. Much thanks.
    Those who want find IPv6 addresses random generator should find it in this topic.

Sign In or Register to comment.