191

Conventional IPv4 dotted quad notation separates the address from the port with a colon, as in this example of a webserver on the loopback interface:

127.0.0.1:80

but with IPv6 notation the address itself can contain colons. For example, this is the short form of the loopback address:

::1

How are ports (or their functional equivalent) expressed in a textual representation of an IPv6 address/port endpoint?

6 Answers 6

267

They work almost the same as today. However, be sure you include [] around your IP.

For example : http://[1fff:0:a88:85a3::ac1f]:8001/index.html

Wikipedia has a pretty good article about IPv6: http://en.wikipedia.org/wiki/IPv6#Addressing

43

The protocols used in IPv6 are the same as the protocols in IPv4. The only thing that changed between the two versions is the addressing scheme, DHCP [DHCPv6] and ICMP [ICMPv6]. So basically, anything TCP/UDP related, including the port range (0-65535) remains unchanged.

Edit: Port 0 is a reserved port in TCP but it does exist. See RFC793

12

Wikipedia points out that the syntax of an IPv6 address includes colons and has a short form preventing fixed-length parsing, and therefore you have to delimit the address portion with []. This completely avoids the odd parsing errors.

(Taken from an edit Peter Wone made to the original question.)

8

I'm pretty certain that ports only have a part in tcp and udp. So it's exactly the same even if you use a new IP protocol

1
  • 1
    DCCP and SCTP also have ports, but ports in SCTP are a little different because of the additional association identifier. Nov 21, 2009 at 23:10
7

They're the same, aren't they? Now I'm losing confidence in myself but I really thought IPv6 was just an addressing change. TCP and UDP are still addressed as they are under IPv4.

2
  • 4
    It is not just an address change. It is supposed to bring some cool features (for example global multicast). But yes, it is transparent to the upper layers. Jan 18, 2009 at 5:34
  • 5
    It is "just" an address change. What you are talking about is addressing :) But the reason it concerns/confuses people is that networking design treats "addressing" as addresses and "services" as port numbers. But you can't do anything in TCP or UDP without both, so most people are trying to get the socket-level addressing to work, and can't understand why people keep making up or changing the delimiter: spaces, then dots, then colons, then pound signs? So, yeah, I can see IPv6 making people worried.
    – benc
    Jul 26, 2009 at 20:18
7

I would say the best reference is Format for Literal IPv6 Addresses in URL's where usage of [] is defined.

Also, if it is for programming and code, specifically Java, I would suggest this readsClass for Inet6Address java/net/URL definition where usage of Inet4 address in Inet6 connotation and other cases are presented in details. For my case, IPv4-mapped address Of the form::ffff:w.x.y.z, for IPv6 address is used to represent an IPv4 address also solved my problem. It allows the native program to use the same address data structure and also the same socket when communicating with both IPv4 and IPv6 nodes. This is the case on Amazon cloud Linux boxes default setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.