dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
3226
share rss forum feed


Abhi

@airtel.in

How to increment IPv6 address?

hii..this is abhi from India.I am very new in IPv6 related issue.
Do u have any idea how to increment IPv6 address using TCL/TK scripting language.

Waiting for your reply....



whfsdude
Premium
join:2003-04-05
Washington, DC

Well you have 65,535 values for each 16 bits in the address.

So just +1 and convert to hex.



Abhi

@122.180.48.x

hii..thnx for your reply..

But I want to know the programming(TCL language) code...or any function or converter..



whfsdude
Premium
join:2003-04-05
Washington, DC
reply to Abhi

Decimal to hex > »wiki.tcl.tk/3242

Keep in mind you will only use that for each 16 bit segment of the address.



Neha Patil

@airtel.in

my ipv6 address is fe80:0000:0000:0000:0204:61ff:fe9d:f156.how to increment in tcl?



whfsdude
Premium
join:2003-04-05
Washington, DC
Reviews:
·Comcast

said by Neha Patil :

my ipv6 address is fe80:0000:0000:0000:0204:61ff:fe9d:f156.how to increment in tcl?

I'm sure there are better ways of doing this (live converting to binary and and just adding).

But here is my easy form answer. You'll obviously want to stick this into a loop.

1. Parse the address backwards until you reach ":",
2. Convert f156 to decimal.(which gives you 61782).
3. +1 your decimal result if less than 65535 (gives you 61783)
4. Convert 61783 back to hex (gives you F157)
5. Concatenate fe80:0000:0000:0000:0204:61ff:fe9d: with F157

Giving you fe80:0000:0000:0000:0204:61ff:fe9d:F157

As having no desire to look at the syntax of TCL, you'll have to figure that out. But it's easy enough that anyone moderately familiar with the language should be able to do it.


Neha Patil

@airtel.in

thnx for yr reply...according to yr suggestion i already done it few steps...but i dint knw TCL....it will better if i find the entire code...my code is -

set hex_value "Fff"
scan $hex_value "%x" final_value
incr final_value
set new_hex_value [format "%X" $final_value]
puts "$new_hex_value"



SomeJoe7777

join:2010-03-30
Houston, TX
kudos:7

First of all, this is a forum about IPv6 implementation and configuration. It is not a programming forum dealing with programming code.

Second, the very idea that you don't know how to convert hex/text to values/decimal and back in your programming language indicates that you're in way over your head and shouldn't be attempting to do this in the first place. This is a simple operation and is trivial to any real programmer.

Third, there is absolutely no need to "increment" an IP address unless you are trying to write something nefarious like a port scanner. As far as I'm concerned, you shouldn't be helped with something like that.

I personally will not help you with this questionable programming code, and hope others won't either.



Asterix
Premium
join:2002-09-18
Nazareth, PA
kudos:3
Reviews:
·RCN CABLE

said by SomeJoe7777:

First of all, this is a forum about IPv6 implementation and configuration. It is not a programming forum dealing with programming code.

Forum description says "For discussion of all things IPv6"

I see nowhere saying specifically "IPv6 implementation and configuration"
--
The art of flying is to throw yourself at the ground and miss