Sei sulla pagina 1di 16

Network Programming

BTCS703
IPv4 & v6 address structures

Octets or segments, or a combination of both, make up Internet Protocol version 4 (IPv4) and
Internet Protocol version 6 (IPv6) addresses.

An IPv4 address has the following format:  x . x . x . x where x is called an octet and must
be a decimal value between 0 and 255. Octets are separated by periods. An IPv4 address must
contain three periods and four octets. The following examples are valid IPv4 addresses:
 1.2.3.4
 01 . 102 . 103 . 104
The following example shows a screen that uses IPv4 addresses.

Ethernet IPv4 Panel 0175

Current Settings Frame 1:

IP Address (IPv4): 19.117.63.126

MAC Address: 18:36:F3:98:4F:9A

Gateway (IPv4): 19.117.63.253

Subnet Mask (IPv4): 255.255.253.0

[BACK] [ UP ] [DOWN] [ENTER]

Ethernet Mode: Manual IP Entry

Press ENTER to Change Settings

An IPv6 address can have either of the following two formats:


 Normal - Pure IPv6 format
 Dual - IPv6 plus IPv4 formats

An IPv6 (Normal) address has the following format:  y : y : y : y : y : y : y : y where y is


called a segment and can be any hexadecimal value between 0 and FFFF. The segments are
separated by colons - not periods. An IPv6 normal address must have eight segments,
however a short form notation can be used in the Tape Library Specialist Web interface for
segments that are zero, or those that have leading zeros. The short form notation can not be
used from the operator panel.
The following list shows examples of valid IPv6 (Normal) addresses:
 2001 : db8: 3333 : 4444 : 5555 : 6666 : 7777 : 8888
 2001 : db8 : 3333 : 4444 : CCCC : DDDD : EEEE : FFFF
 : : (implies all 8 segments are zero)
 2001: db8: : (implies that the last six segments are zero)
 : : 1234 : 5678 (implies that the first six segments are zero)
 2001 : db8: : 1234 : 5678 (implies that the middle four segments are zero)
 2001:0db8:0001:0000:0000:0ab9:C0A8:0102 (This can be compressed to eliminate
leading zeros, as follows: 2001:db8:1::ab9:C0A8:102 )
The following example shows a screen that uses IPv6 addresses:

Ethernet IPv6 Panel 0178

Current Settings
Frame 1, Port B

Manual IP (IPv6): 684D:1111:222:3333:4444:5555:6:77

MAC Address: 18:36:F3:98:4F:9A


DHCP IP (IPv6): Disabled

Press ENTER to Change Settings

Stateless Auto IP (IPv6): 0:0:0:0:0:0:0:0

[BACK] [ UP ] [DOWN] [ENTER]

An IPv6 (Dual) address combines an IPv6 and an IPv4 address and has the following
format: y : y : y : y : y : y : x . x . x . x. The IPv6 portion of the address (indicated with y's) is
always at the beginning, followed by the IPv4 portion (indicated with x's).

 In the IPv6 portion of the address, y is called a segment and can be any hexadecimal
value between 0 and FFFF. The segments are separated by colons - not periods. The
IPv6 portion of the address must have six segments but there is a short form notation
for segments that are zero.

 In the IPv4 portion of the address x is called an octet and must be a decimal value
between 0 and 255. The octets are separated by periods. The IPv4 portion of the
address must contain three periods and four octets.
The following list shows examples of valid IPv6 (Dual) addresses:
 2001 : db8: 3333 : 4444 : 5555 : 6666 : 1 . 2 . 3 . 4
 : : 11 . 22 . 33 . 44 (implies all six IPv6 segments are zero)
 2001 : db8: : 123 . 123 . 123 . 123 (implies that the last four IPv6 segments are zero)
 : : 1234 : 5678 : 91 . 123 . 4 . 56 (implies that the first four IPv6 segments are zero)
 : : 1234 : 5678 : 1 . 2 . 3 . 4 (implies that the first four IPv6 segments are zero)
 2001 : db8: : 1234 : 5678 : 5 . 6 . 7 . 8 (implies that the middle two IPv6 segments are
zero)

IPv4 Address Example


An example ip-address:

69.89.31.226

The above ip-address is in the dotted decimal number format. An ip address is in the format
of 4 sets of decimal numbers separated by dots. The decimal number in each and every set is
in the range 0 to 255. Each and every set is called octet. So, there are 4 octets in an ip
address.
However systems understands ip-address only in the binary format. So, when you configure
your system with an ip-address in a dotted decimal number format, it is converted to a binary
number format internally by the system as shown below.

01000101010110010001111111100010

(or)

01000101.01011001.00011111.11100010

IPv4 IP address are 32 bit numbers. In the above binary format, there are total of 32 binary
numbers. Each and every binary number that are separated by the dot is converted to its
corresponding binary number. There are total of 4 bytes here.
Each and every octet can have a value from 0 to 255. Since there are 4 octets in an ip-address,
the total possible combination of unique ipv4 ip addresses are 4,294,967,296.
IPv6 Address Example
IPv4 stands for Internet Protocol Version 4. Most of the networks and systems in the internet
is currently configured for IPv4. Since IPv4 ip address has only 32 bits (a total of
4,294,967,296 unique ip-addresses), the ip addresses in the internet are running out quickly.
Please note that there is a big block of these ip addresses are reserved for special purposes
(for example, private network and multicast addresses).
IPv6 stands for Internet Protocol Version 6. Since there is a possibility that we might run out
of ip address in the internet, IPv6 was developed. IPv6 ip address has 128 bits. This is a huge
improvement from the 32 bit ipv4 ip address. While lot of networks are getting configured for
both IPv4 and IPv6, there is still a huge number of networks and systems in the internet that
works only for IPv4. But eventually all these systems might go towards the IPv6 route.
IPv6 ip address is typically written in hexadecimal separated by colon. A colon separates 16
bit. The following is an example of IPv6 address:

2002:4559:1FE2::4559:1FE2

Leading zeros can be truncated. For example “0000” can be be just written as empty. In the
above example :: indicates that it has multiple 0’s in that location. Typically the IPv6 format
can be written down in three ways 1) compressed, 2) uncompressed and 3) fully
uncompressed as shown below. All of the following are the same:
 IPv6 Compressed (0000 is not displayed) – 2002:4559:1FE2::4559:1FE2
 IPv6 Uncompressed (0000 is displayed as 0) – 2002:4559:1FE2:0:0:0:4559:1FE2
 IPv6 Fully Uncompressed (0000 is fully displayed) –
2002:4559:1FE2:0000:0000:0000:4559:1FE2
Execute “ifconfig -a” which will display both ipv4 and ipv6 ip-addresss (if it is configured
appropriately):

# ifconfig -a | egrep 'inet|inet6'

inet addr:69.89.31.226

inet6 addr: 2002:4559:1fe2::4559:1fe2

Comparison :-

Description IPv4 IPv6

Address 32 bits long (4 bytes). Address 128 bits long (16 bytes). Basic architecture is
is composed of a network and 64 bits for the network number and 64 bits for
a host portion, which depend the host number. Often, the host portion of an
Description IPv4 IPv6

on address class. Various IPv6 address (or part of it) will be derived
address classes are defined: A, from a MAC address or other interface
B, C, D, or E depending on identifier.
initial few bits. The total Depending on the subnet prefix, IPv6 has a
number of IPv4 addresses is 4 more complicated architecture than IPv4.
294 967 296. The number of IPv6 addresses is 1028 (79 228
The text form of the IPv4 162 514 264 337 593 543 950 336) times
address isnnn.nnn.nnn.nnn, larger than the number of IPv4 addresses. The
where 0<=nnn<=255, and text form of the IPv6 address
eachn is a decimal digit. isxxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx,
Leading zeros can be omitted. where eachx is a hexadecimal digit,
Maximum number of print representing 4 bits. Leading zeros can be
characters is 15, not counting omitted. The double colon (::) can be used
a mask. once in the text form of an address, to
designate any number of 0 bits. For
example, ::ffff:10.120.78.40 is an IPv4-
mapped IPv6 address. (See  RFC 3513  for
details.

To view this RFC, see RFC Editor   


(www.rfc-editor.org/rfcsearch.html).

Address Originally, addresses were Allocation is in the earliest stages. The


allocation allocated by network class. As Internet Engineering Task Force (IETF) and
address space is depleted, Internet Architecture Board (IAB) have
smaller allocations using recommended that essentially every
Classless Inter-Domain organization, home, or entity be allocated
Routing (CIDR) are made. a /48 subnet prefix length. This would leave 16
Allocation has not been bits for the organization to do subnetting. The
balanced among institutions address space is large enough to give every
and nations. person in the world their own /48 subnet prefix
length.

Address Generally, not an applicable IPv6 addresses have two lifetimes: preferred
lifetime concept, except for addresses and valid, with the preferred lifetime always
Description IPv4 IPv6

assigned using DHCP. <= valid.


 After the preferred lifetime expires, the
address is not to be used as a source IP address
for new connections if an equally good
preferred address is available. After the valid
lifetime expires, the address is not used
(recognized) as a valid destination IP address
for incoming packets or used as a source IP
address. 
Some IPv6 addresses have, by definition,
infinite preferred and valid lifetimes; for
example link-local (see address scope).

Address Used to designate network Not used (see address prefix).


mask from host portion.

Address Sometimes used to designate Used to designate the subnet prefix of an


prefix network from host portion. address. Written as/nnn (up to 3 decimal
Sometimes written digits, 0 <= nnn <= 128) suffix after the print
as /nn suffix on presentation form. An example is fe80::982:2a5c/10, where
form of address. the first 10 bits comprise the subnet prefix.

Address Address Resolution Protocol is IPv6 embeds these functions within IP itself as
Resolution used by IPv4 to find a physical part of the algorithms for stateless
Protocol address, such as the MAC or autoconfiguration and neighbor discovery
(ARP) link address, associated with using Internet Control Message Protocol
an IPv4 address. version 6 (ICMPv6). Hence, there is no such
thing as ARP6.

Address For unicast addresses, the  In IPv6, address scope is part of the
scope concept does not apply. There architecture. Unicast addresses have two
are designated private address defined scopes, including link-local and
ranges and loopback. Outside global; and multicast addresses have 14
of that, addresses are assumed scopes. Default address selection for both
to be global. source and destination takes scope into
account. 
Description IPv4 IPv6

A scope zone is an instance of a scope in a


particular network. As a consequence, IPv6
addresses sometimes must be entered or
associated with a zone ID. The syntax
is %zid wherezid is a number (usually small)
or a name. The zone ID is written after the
address and before the prefix. For
example,2ba::1:2:14e:9a9b:c%3/48.

Address Unicast, multicast, and Unicast, multicast, and anycast. See IPv6


types broadcast. address types for descriptions.

Communica A tool to collect a detailed  Same for IPv6, and IPv6 is supported. 
tions trace trace of TCP/IP (and other)
packets that enter and leave
the system.

Configurati You must configure a newly  Configuration is optional, depending on


on installed system before it can functions required. IPv6 can be used with any
communicate with other Ethernet adapter and can be run over the
systems; that is, IP addresses loopback interface. IPv6 interfaces are self-
and routes must be assigned. configuring using IPv6 stateless
autoconfiguration. You can also manually
configure the IPv6 interface. So, the system
will be able to communicate with other IPv6
systems that are local and remote, depending
on the type of network and whether an IPv6
router exists. 

Domain Applications accept host Same for IPv6. Support for IPv6 exists using
Name names and then use DNS to AAAA (quad A) record type and reverse
System get an IP address, using socket lookup (IP-to-name). An application may elect
(DNS) APIgethostbyname(). to accept IPv6 addresses from DNS (or not)
Applications also accept IP and then use IPv6 to communicate (or not).
addresses and then use DNS to  The socket API gethostbyname() only
get host names supports IPv4. For IPv6, a
Description IPv4 IPv6

using gethostbyaddr(). new getaddrinfo() API is used to obtain (at


For IPv4, the domain for application choice) IPv6 only, or IPv4 and
reverse lookups is in- IPv6 addresses. 
addr.arpa. For IPv6, the domain used for reverse lookups
is ip6.arpa, and if not found then ip6.int (see
API getnameinfo()).

Dynamic Used to dynamically obtain an The i5/OS implementation of DHCP does not
Host IP address and other support IPv6.
Configurati configuration
on Protocol information. i5/OS supports a
(DHCP) DHCP server for IPv4.

File File Transfer Protocol allows The i5/OS implementation of FTP does not
Transfer you to send and receive files support IPv6.
Protocol across networks.
(FTP)

Fragments When a packet is too big for  For IPv6, fragmentation can only occur at the
the next link over which it is source node, and reassembly is only done at
to travel, it can be fragmented the destination node. The fragmentation
by the sender (host or router). extension header is used. 

Host table On iSeries Navigator, a Currently, this table does not support IPv6.
configurable table that Customers need to configure an AAAA record
associates an Internet address in a DNS for IPv6 domain resolution. You can
with a host name; for run the DNS locally on the same system as the
example, 127.0.0.1, loopback. resolver, or you can run it on a different
This table is used by the system.
sockets name resolver, either
before a DNS lookup or after a
DNS lookup fails (determined
by host name search priority).

Interface The conceptual or logical Same concept as IPv4.


entity used by TCP/IP to send Can be started and stopped independently of
Description IPv4 IPv6

and receive packets and each other and independently of TCP/IP using
always closely associated with iSeries Navigator only.
an IPv4 address, if not named
with an IPv4 address.
Sometimes referred to as a
logical interface.
Can be started and stopped
independently of each other
and independently of TCP/IP
using STRTCPIFC and
ENDTCPIFC commands and
using iSeries Navigator.

Internet ICMP is used by IPv4 to Used similarly for IPv6; however, Internet
Control communicate network Control Message Protocol version 6 (ICMPv6)
Message information. provides some new attributes.
Protocol Basic error types remain, such as destination
(ICMP) unreachable, echo request and reply. New
types and codes are added to support neighbor
discovery and related functions.

Internet IGMP is used by IPv4 routers Replaced by MLD (multicast listener


Group to find hosts that want traffic discovery) protocol for IPv6. Does essentially
Managemen for a particular multicast what IGMP does for IPv4, but uses ICMPv6
t Protocol group, and used by IPv4 hosts by adding a few MLD-specific ICMPv6 type
(IGMP) to inform IPv4 routers of values.
existing multicast group
listeners (on the host).

IP header Variable length of 20-60 Fixed length of 40 bytes. There are no IP


bytes, depending on IP options header options. Generally, the IPv6 header is
present. simpler than the IPv4 header.

IP header Various options that might The IPv6 header has no options. Instead, IPv6
options accompany an IP header adds additional (optional) extension headers.
(before any transport header). The extension headers are AH and ESP
Description IPv4 IPv6

(unchanged from IPv4), hop-by-hop, routing,


fragment, and destination. Currently, IPv6
supports some extension headers.

IP header The protocol code of the The type of header immediately following the
protocol transport layer or packet IPv6 header. Uses the same values as the IPv4
byte payload; for example, ICMP. protocol field. But the architectural effect is to
allow a currently defined range of next
headers, and is easily extended. The next
header will be a transport header, an extension
header, or ICMPv6.

IP header Used by QoS and Designates the IPv6 traffic class, similarly to
Type of differentiated services to IPv4. Uses different codes. Currently, IPv6
Service designate a traffic class. does not support TOS.
(TOS) byte

iSeries iSeries Navigator provides a Same for IPv6. No CL commands are


Navigator complete configuration available for IPv6 configuration.
support solution for TCP/IP.

LAN Used by an IP interface to get  IPv6 can be used with any Ethernet adapters
connection to the physical network. Many and is also supported over virtual Ethernet
types exist; for example, token between logical partitions. 
ring, and Ethernet. Sometimes
referred to as the physical
interface, link, or line.

Layer 2 L2TP can be thought of as Currently, the i5/OS implementation of L2TP


Tunnel virtual PPP, and works over does not support IPv6.
Protocol any supported line type.
(L2TP)

Loopback An interface with an address The concept is the same as in IPv4. The single
address of 127.*.*.*(typically 127.0.0. loopback address
1) that can only be used by a is 0000:0000:0000:0000:0000:0000:0000:0001 
node to send packets to itself. or::1 (shortened version). The virtual physical
Description IPv4 IPv6

The physical interface (line interface is named *LOOPBACK .


description) is named
*LOOPBACK.

Maximum Maximum transmission unit of IPv6 has an architected lower bound on MTU
Transmissio a link is the maximum number of 1280 bytes. That is, IPv6 will not fragment
n Unit of bytes that a particular link packets below this limit. To send IPv6 over a
(MTU) type, such as Ethernet or link with less than 1280 MTU, the link-layer
modem, supports. For IPv4, must transparently fragment and defragment
576 is the typical minimum. the IPv6 packets.

Netstat A tool to look at the status of Same for IPv6, and IPv6 is supported for both
TCP/IP connections, 5250 and iSeries Navigator.
interfaces, or routes. Available
using iSeries Navigator and
5250.

Network Basic firewall functions Currently, NAT does not support IPv6. More
Address integrated into TCP/IP, generally, IPv6 does not require NAT. The
Translation configured using iSeries expanded address space of IPv6 eliminates the
(NAT) Navigator. address shortage problem and enables easier
renumbering.

Network On iSeries Navigator, a Currently, no changes are made to this table


table configurable table that for IPv6.
associates a network name
with an IP address without
mask. For example, host
Network14 and IP address
1.2.3.4.

Node info Does not exist. A simple and convenient network tool that
query should work like ping, except with content: an
IPv6 node may query another IPv6 node for
the target's DNS name, IPv6 unicast address,
or IPv4 address. Currently, not supported.
Description IPv4 IPv6

Packet Basic firewall functions You cannot use packet filtering with IPv6.
filtering integrated into TCP/IP,
configured using iSeries
Navigator.

Packet The i5/OS TCP/IP stack can IPv6 packets are not forwarded.


forwarding be configured to forward IP
packets it receives for
nonlocal IP addresses.
Typically, the inbound
interface and outbound
interface are connected to
different LANs.

PING Basic TCP/IP tool to test Same for IPv6, and IPv6 is supported, for both
reachability. Available using 5250 and iSeries Navigator.
iSeries Navigator and 5250.

Point-to- PPP supports dialup interfaces  Currently, the i5/OS implementation of PPP
Point over various modem and line does not support IPv6. 
Protocol types.
(PPP)

Port These i5/OS panels allow a  Same for IPv6. Port restrictions for IPv6 are
restrictions customer to configure a identical to those available in IPv4.  
selected port number or port
number ranges for TCP or
UDP so that they are only
available for a specific profile.

Ports TCP and UDP have separate For IPv6, ports work the same as IPv4.
port spaces, each identified by Because these are in a new address family,
port numbers in the range 1- there are now four separate port spaces. For
65535. example, there are two TCP port 80 spaces to
which an application can bind, one in
AF_INET and one in AF_INET6.
Description IPv4 IPv6

Private and All IPv4 addresses are public, IPv6 has an analogous concept, but with
public except for three address ranges important differences.
addresses that have been designated as Addresses are public or temporary, previously
private by IETF RFC termed anonymous. See RFC 3041. Unlike
1918: 10.*.*.* IPv4 private addresses, temporary addresses
(10/8),172.16.0.0 through 172. can be globally routed. The motivation is also
31.255.255 (172.16/12) , different; IPv6 temporary addresses are meant
and 192.168.*.* (192.168/16). to shield the identity of a client when it
Private address domains are initiates communication (a privacy concern).
commonly used within Temporary addresses have a limited lifetime,
organizations. Private and do not contain an interface identifier that
addresses cannot be routed is a link (MAC) address. They are generally
across the Internet. indistinguishable from public addresses.
IPv6 has the notion of limited address scope
using its architected scope designations
(see address scope).

Protocol On iSeries Navigator, a  The table can be used with IPv6 without
table configurable table that change. 
associates a protocol name
with its assigned protocol
number; for example, UDP,
17. The system is shipped with
a small number of entries: IP,
TCP, UDP, ICMP.

Quality of Quality of service allows you  Currently, the i5/OS implementation of QoS
service to request packet priority and does not support IPv6. 
(QoS) bandwidth for TCP/IP
applications.

Renumberin Done by manual Is an important architectural element of IPv6,


g reconfiguration, with the and is largely automatic, especially within
possible exception of DHCP. the /48 prefix.
Generally, for a site or
Description IPv4 IPv6

organization, a difficult and


troublesome process to avoid
if possible.

Route Logically, a mapping of a set  Conceptually, similar to IPv4. One important


of IP addresses (might contain difference: IPv6 routes are associated (bound)
only one) to a physical to a physical interface (a link, such as ETH03)
interface and a single next-hop rather than an interface. One reason that a
IP address. IP packets whose route is associated with a physical interface is
destination address is defined because source address selection functions
as part of the set are forwarded differently for IPv6 than for IPv4. See Source
to the next hop using the line. address selection.  
IPv4 routes are associated
with an IPv4 interface, hence,
an IPv4 address.
The default route is
*DFTROUTE.

Routing RIP is a routing protocol Currently, RIP does not support IPv6. IPv6
Information supported by the routed routing uses static routes.
Protocol daemon.
(RIP)

Services On i5/OS, a configurable table No changes are made to this table for IPv6.
table that associates a service name
with a port and protocol; for
example, service name FTP-
control, port 21, TCP, and
User Datagram Protocol
(UDP).
A large number of well-known
services are listed in the
services table. Many
applications use this table to
determine which port to use.
Description IPv4 IPv6

Simple SNMP is a protocol for system  Currently, the i5/OS implementation of


Network management. SNMP does not support IPv6.  
Managemen
t Protocol
(SNMP)

Sockets API These APIs are the way IPv6 enhances sockets so that applications can
applications use TCP/IP. now use IPv6, using a new address family:
Applications that do not need AF_INET6.
IPv6 are not affected by The enhancements have been designed so that
sockets changes to support existing IPv4 applications are completely
IPv6. unaffected by IPv6 and API changes.
Applications that want to support concurrent
IPv4 and IPv6 traffic, or IPv6-only traffic, are
easily accommodated using IPv4-mapped IPv6
addresses of the form::ffff:a.b.c.d,
where a.b.c.d is the IPv4 address of the client.
The new APIs also include support for
converting IPv6 addresses from text to binary
and from binary to text.
See Using AF_INET6 address family for more
information about sockets enhancements for
IPv6.

Source An application may designate As with IPv4, an application can designate a


address a source IP (typically, using source IPv6 address using bind(). Similarly to
selection sockets bind()). If it binds to IPv4, it can let the system choose an IPv6
INADDR_ANY, a source IP is source address by using in6addr_any. But
chosen based on the route. because IPv6 lines have many IPv6 addresses,
the internal method of choosing a source IP is
different.

Starting and Use STRTCP and ENDTCP to Same as IPv4. IPv4 and IPv6 are not started or
stopping start or end TCP/IP. stopped independently of one another or
independently of TCP/IP. That is, you start
Description IPv4 IPv6

and stop all of TCP/IP, not just IPv4 or IPv6.


 Any IPv6 interfaces are automatically started
if the AUTOSTART parameter = *YES (the
default). IPv6 cannot be used or configured
without IPv4. The IPv6 loopback interface,::1,
will automatically be defined and activated
when IPv6 is started. 

Telnet Telnet allows you to log on  Currently, the i5/OS implementation of Telnet
and use a remote computer as does not support IPv6. 
though you were connected to
it directly.

Trace route Basic TCP/IP tool to do path Same for IPv6, and IPv6 is supported for both
determination. Available using 5250 and iSeries Navigator.
iSeries Navigator and 5250.

Transport  TCP, UDP, RAW.   The same transports exist in IPv6.


layers

Unspecified Apparently, not defined, as Defined as ::/128 (128 0 bits). It is used as the


address such. Socket programming source IP in some neighbor discovery packets,
uses 0.0.0.0 as and various other contexts, like sockets.
INADDR_ANY. Socket programming
uses ::/128 asin6addr_any.

Virtual Virtual private network (using  Currently, the i5/OS implementation of VPN
private IPsec) allows you to extend a does not support IPv6.  
network secure, private network over
(VPN) an existing public network.

Potrebbero piacerti anche