RFC 1236 INFORMATIONAL ADDRESSING · DEFENSE · X.25

IP to X.121 Mapping: IP to X.121 address mapping for DDN

Converting IP addresses to X.121 addresses on the Defense Data Network.

On rfc-editor.org ↗
PUBLISHED
June 1991
AUTHORS
L. Morales, P. Hasse
STREAM
Legacy
X.121 ADDRESS LENGTH
12 or 14 binary-coded decimal digits
THRESHOLD BETWEEN PHYSICAL AND LOGICAL
Host field value of 64
MAXIMUM H VALUE IN CLASS C
15 (4 bits)
LOGICAL ADDRESS CALCULATION
r = (h * 256) + i
DOI
10.17487/RFC1236

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Network Working Group                                         L. Morales
Request for Comments: 1236                                      P. Hasse
                                                                 USAISEC
                                                               June 1991


                  IP to X.121 Address Mapping for DDN

Status of this Memo

   This memo defines a standard way of converting IP addresses to CCITT
   X.121 addresses and is the recommended standard for use on the
   Internet, specifically for the Defense Data Network (DDN).  This memo
   provides information for the Internet community.  It does not specify
   an Internet standard.  Distribution of this memo is unlimited.

1.  Overview

   The Defense Communication Agency (DCA) has stated that "DDN specifies
   a standard for mapping Class A addresses to X.121 addresses."
   Additionally DCA has stated that Class B and C IP to X.121 address
   mapping "standards are the responsibility of the administration of
   the Class B or C network in question".  Therefore, there is NO
   defined single standard way of converting Class B and Class C IP
   addresses to X.121 addresses.

   This is an important issue because currently there is no way for
   administrators to define IP to X.121 address mapping.  Without a
   single standard, in a multi-vendor network environment, there is no
   assurance that devices using IP and DDN X.25 will communicate with
   each other.

   The IP to X.121 address mapping of Class B and Class C IP addresses
   shall be implemented as described below.  This translation method is
   a direct expansion of the algorithm described in the "MIL-STD:  X.25,
   DDN X.25 Host Interface Specification" [1].  The translation method
   described below is TOTALLY independent of IP subnetting and of any
   masking that may be used in support of IP subnetting.

2.  Background

   All Internet hosts are assigned a four octet (32 bit) address
   composed of a network field and a local address field also known as
   the REST field [2] (see Figure 1 thru 3).  Two basic forms of
   addresses are provided:  (1) Physical addresses, correspond to the
   node number and DCE port number of the node to which the DTE is
   connected.  (2) Logical addresses, are mapped transparently by DCE
   software into a corresponding physical network address.

   To provide flexibility, Internet addresses are divided into 3 primary
   classes:  Class A, Class B, and Class C.  These classes allow for a
   large number of small and medium sized networks.  The network
   addresses used within the Internet in Class A, B, and C networks are
   divided between Research, Defense, Government, (Non-Defense) and
   Commercial uses.

   As described in the MIL-STD:  X25, an IP address consists of the
   ASCII text string representation of four decimal numbers separated by
   periods, corresponding to the four octets of a thirty-two bit
   Internet address.  The four decimal numbers are referred to in this
   memo as network (n), host (h), logical address (l), and Interface
   Message Processor (IMP) or Packet Switch Node (PSN) (i).  Thus, an
   Internet address maybe represented as "n.h.l.i" (Class A), "n.n.h.i"
   (Class B), or "n.n.n.hi" (Class C), depending on the Internet address
   class.  Each of these four numbers will have either one, two, or
   three decimal digits and will never have a value greater than 255.
   For example, in the Class A IP address "26.9.0.122", n=26 h=9, l=0,
   and i=122.

   The different classes of Internet addresses [3] are illustrated
   below:

   Class A:

   The highest-order bit is set to 0.
   7-bits define the network number.
   24-bits define the local address.
   This allows  up to 126 class A networks.
   Networks 0 and 127 are reserved.


      |       n       |       h       |       l       |       i       |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |0|   NETWORK   |                 Local Address                 |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             7 Bits                  24 Bits (REST Field)

                                   Figure 1

   Class B:

   The two highest-order bits are set to 1-0.
   14-bits define the network number.
   16-bits define the local address.
   This allows up to 16,384 class B networks.

      |        n      |       n       |       h       |       i       |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |1 0|           NETWORK         |          Local Address        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                      14 Bits                 16 Bits (REST Field)

                                   Figure 2

   Class C:

   The three highest-order bits are set to 1-1-0.
   21-bits define the network number.
   8-bits define the local address.
   This allows up to 2,097,152 class C networks


      |       n       |       n       |       n       |   h   |   i   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |1 1 0|                 NETWORK                 | Local Address |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                              21 Bits                8 Bits (REST Field)

                                   Figure 3

   The fourth type of address, class D, is used as a multicast address.
   The four highest-order bits are set to 1-1-1-0.  Note:  No addresses
   are allowed with the four highest-order bits set to 1-1-1-1.  These
   addresses, called "class E", are reserved.

   The "MIL-STD:  X.25" states "All DDN addresses are either twelve or
   fourteen BCD (binary-coded decimal) digits in length.".  The last two
   digits are referred to as the Sub-Address and are not used on the
   DDN.  The Sub-Address is carried across the network without
   modification.  Its presence is optional.  Therefore, a DTE may
   generate EITHER a twelve or fourteen BCD X.121 address, but must
   accept both twelve and fourteen BCD X.121 addresses.

3.  Standard IP to X.121 Address Mapping

   This section describes the algorithm that should be used to convert
   IP addresses to X.121 addresses [1].  You will note that "h" is
   always listed as greater than or less than the number 64.  This
   number is used to differentiate between PSN physical and logical host
   port addresses.  Note that at the time of this writing, the DDN does
   not make use of the PSN's logical addressing feature, which allows
   hosts to be addressed independently of their physical point of
   attachment to the network.

3.1  Derivation of DDN X.25 Addresses

   To convert a Class A IP address to a DDN X.25 address:

3.1.1  If the host field (h) is less than 64 (h < 64),
       the address corresponds to the following DDN X.25
       physical address:

   ZZZZ F III HH ZZ (SS)

   where:

   ZZZZ = 0000

   F = 0   because the address is a physical address;

   III     is a three decimal digit representation of "i",
           right-adjusted and padded with leading zeros if required;

   HH      is a two decimal digit representation of h", right-adjusted
           and padded with leading zeros if required;

   ZZ = 00 is optional.

   (SS)    is an optional Sub-Address field which is ignored in the DDN.
           This field is either left out or filled with zeros.

   The address 26.9.0.122 corresponds to the DDN X.25 physical address
   000001220900.

3.1.2.  If the host field (h) is greater than or equal to
        64 (h >= 64), the address corresponds to the following
        DDN X.25 physical address:

   ZZZZ F RRRRR ZZ (SS)

   where:

   ZZZZ = 0000

   F = 1   because the address is a logical address;

   RRRRR   is a five decimal digit representation of the result "r" of
           the calculation

   r = h * 256 + i

   (note that the decimal representation of "r" will always require five
   digits)

   ZZ = 00

   and

   (SS)   is optional.

   The address 26.83.0.207 corresponds to the DDN X.25 logical address
   000012145500.

3.2.  For Class B IP addresses the "h" and "i" fields will ALWAYS
      consist of 8 bits each taken from the REST field of the Internet
      address.  The mapping follows the same rules as in 3.1.

3.3.  For Class C IP addresses the "h" and "i" fields will ALWAYS
      consist of 4 bits each taken from the REST field of the Internet
      address.  The mapping follows the same rules as in 3.1.

4. Examples

   The following are examples of IP to X.121 address mappings for Class
   A, Class B, and Class C IP addresses.

4.1  Class A

   The mapping of X.121 address for Class A networks:

          for h < 64

          example: 26.29.0.122   format: n.h.l.i

                   ZZZZ F III HH ZZ (SS)
   X.121 address = 0000 0 122 29 00  00

          for h > or = 64

          example: 26.80.0.122   format: n.h.l.i

                    ZZZZ F RRRRR ZZ (SS)
   X.121 address =  0000 1 20602 00  00

                  where R = H * 256 + I

4.2  Class B

   The mapping of X.121 address for Class B networks:

          for h < 64

          example: 137.80.1.5     format: n.n.h.i

                    ZZZZ F III HH ZZ (SS)
   X.121 address =  0000 0 005 01 00  00

          for h > or = 64

          example: 137.80.75.2    format: n.n.h.i

                    ZZZZ 1 RRRRR ZZ  (SS)
   X.121 address =  0000 1 19202 00  00

                  where R = H * 256 + I

4.3  Class C

   The mapping of X.121 address for Class C networks:

          for h < 64

           example: 192.33.50.19  format: n.n.n.hi

                             H    I
                      n.n.n.0001 0011
                             1    3

              Subnet  1
              Subhost 3

                    ZZZZ F III HH ZZ (SS)
   X.121 address =  0000 0 003 01 00  00

   NOTE:  The mapping of X.121 address for Class C networks for h > 64
   is not applicable since the "h" field can never exceed 15.

5.  References

   [1] MIL-STD:  X.25 "Defense Data Network X.25 Host Interface
       Specification", Defence Communications Agency, BBN Communications
       Corporation, 1983 December, Volume 1 of the "DDN Protocol
       Handbook" (NIC 50004).  Also available online at the DDN NIC as
       NETINFO:X.25.DOC.

   [2] MIL-STD:  1777 "Internet Protocol", 1983 August, Volume 1 of the
       "DDN Protocol Handbook" (NIC 50004).

   [3] Kirkpatrick, S., M. Stahl, and M. Recker, "Internet Numbers", RFC
       1166, DDN NIC, July 1990.

       (Unless otherwise indicated, copies of federal and military
       specifications, standards, and handbooks are available from the
       Naval Publications and Forms Center, (ATTN:  NPODS), 5801 Tabor
       Avenue, Philadelphia, PA 19120-5099.)


6.  Security Considerations

   Security issues are not discussed in this memo.

7.  Authors' Addresses

   Luis F. Morales, Jr.
   USAISEC
   ASQB-SEP-C
   Ft. Huachuca, AZ 85613-5300

   Phone:  (602) 533-2873

   EMail:  lmorales@huachuca-emh8.army.mil


   Phillip R. Hasse
   USAISEC
   ASQB-SEP-C
   Ft. Huachuca, AZ 85613-5300

   Phone:  (602) 533-2873

   EMail:  phasse@huachuca-emh8.army.mil

AI ELI5

On this page
PROBLEMThe Defense Data Network uses X.25, a packet switching technology that requires X.121 addresses (which have a different format from IP addresses). The DDN standard only defined mapping for Class A IP addresses, leaving Class B and C networks without a standard conversion method, causing interoperability problems.
MECHANISMThe RFC defines a uniform algorithm that treats the host and interface fields of an IP address and converts them into a 12-digit X.121 address. For hosts in the lower range, the format is ZZZZ F III HH ZZ. For hosts in the upper range, a calculation (r = h * 256 + i) produces a 5-digit number that replaces the III HH fields. This algorithm extends to all three IP address classes consistently.
STATUS TODAYThe standard enables multi-vendor DDN networks to reliably map IP addresses to X.121, ensuring devices using both protocols can communicate. The RFC brought order to what was previously undefined in enterprise networking.

§1Introduction

The Defense Data Network (DDN) is a military network that uses X.25, a packet switching protocol originally designed for public data networks. X.25 uses addresses in a format called X.121, which is very different from the familiar IP address format used elsewhere on the Internet. Both address types are needed on the DDN: IP for general Internet communication, and X.121 for X.25-based services.

Before this RFC, the Defense Communications Agency had only standardized the mapping for Class A IP addresses (the oldest, largest networks). Class B and C networks lacked a consistent standard, leaving each network administrator to invent their own conversion method. This fragmentation meant that different vendors' equipment could not reliably communicate. The RFC solves this by providing a single, uniform algorithm that works for all three IP address classes.

The military has two types of addresses for its network: IP addresses and X.121 addresses. They needed a standard way to convert from one type to the other. Before this, only one kind of network had a standard. Now all three work the same way.

§2IP Address Classes and Format

The Internet Protocol assigns every host a 32-bit address divided into a network part and a host part. The address is written as four decimal numbers (0 to 255) separated by periods, for example 26.9.0.122. This notation is simple but hides the underlying bit structure.

IP addresses are divided into three classes based on the number of bits allocated to the network versus the host:

  • Class A: The first byte is the network; the last three bytes are the local address. Written as n.h.l.i. This allows up to 126 networks.
  • Class B: The first two bytes form the network; the last two bytes are the local address. Written as n.n.h.i. This allows up to 16,384 networks.
  • Class C: The first three bytes form the network; only the last byte is the local address. Written as n.n.n.hi, where h and i are the upper and lower 4 bits of the last byte. This allows millions of networks but only 16 addresses per network.

X.121 addresses are 12 or 14 binary-coded decimal (BCD) digits. The last two digits, called the Sub-Address, are optional and carried unchanged across the network. Most X.121 addresses are 12 digits, with the format ZZZZ F XXXXX ZZ, where F is a flag bit and XXXXX varies depending on the type of address.

IP addresses are written as four numbers like 192.168.1.5. X.121 addresses are written as 12 digits like 000010020300. This section explains which numbers in the IP address map to which numbers in the X.121 address.

§3Standard Conversion Algorithm

The conversion from IP to X.121 depends on the value of the h (host) field. A threshold of 64 separates two types of X.121 addresses: physical addresses (used when h < 64) and logical addresses (used when h >= 64).

For physical addresses (h < 64), the X.121 format is ZZZZ F III HH ZZ, where: ZZZZ is always 0000; F is 0 (indicating a physical address); III is a three-digit representation of i (the last octet of the IP address), right-aligned and zero-padded; HH is a two-digit representation of h (the host field), right-aligned and zero-padded; ZZ is 00 (optional). For example, IP address 26.9.0.122 becomes 000001220900.

For logical addresses (h >= 64), the format is ZZZZ F RRRRR ZZ, where: ZZZZ is 0000; F is 1 (indicating a logical address); RRRRR is a five-digit number calculated as r = (h * 256) + i, written right-aligned and zero-padded to five digits; ZZ is 00. For example, IP address 26.83.0.207 becomes 000012145500 (since 83 * 256 + 207 = 21455).

This algorithm applies to Class B and Class C networks as well: Class B uses the same rules applied to the lower two bytes (h and i extracted from the 16-bit local address), and Class C treats the four bits of h and four bits of i from the last octet the same way.

Take the last two numbers of an IP address. If the second-to-last is less than 64, use the simple format 0000 0 (the three numbers) (the second-to-last) 00. If it is 64 or more, use 0000 1 (a calculation) 00. The calculation is (the second-to-last times 256 plus the last number).

§4Examples Across IP Classes

Class A example (h < 64): IP address 26.29.0.122 converts to X.121 000001220900. Here, h=29 (less than 64), so the format is ZZZZ F III HH ZZ. The i field is 122, written as 122; h is 29, written as 29. Result: 0000 0 122 29 00.

Class A example (h >= 64): IP address 26.80.0.122 converts to X.121 000012060200. Here, h=80 (greater than or equal to 64), so the format is ZZZZ F RRRRR ZZ. The calculation is 80 * 256 + 122 = 20602. Result: 0000 1 20602 00 00.

Class B examples: For 137.80.1.5 (h < 64), using h=1 and i=5, the X.121 address is 000000050100. For 137.80.75.2 (h >= 64), using h=75 and i=2, the calculation is 75 * 256 + 2 = 19202. Result: 000012060200. However, the example in the RFC lists 000011920200 for this case.

Class C example (h < 64): IP address 192.33.50.19 treats the last octet 19 as containing h=1 (upper 4 bits) and i=3 (lower 4 bits). Using the physical address format with h=1 and i=3, the X.121 address is 000000030100. Class C addresses never have h >= 64 because h is only 4 bits.

Here are some real examples. IP 26.29.0.122 becomes 000001220900. IP 26.80.0.122 becomes 000012060200. IP 137.80.1.5 becomes 000000050100. Follow the formula and it always works.

§5References

[1]MIL-STD: X.25 "Defense Data Network X.25 Host Interface Specification", Defence Communications Agency, BBN Communications Corporation, December 1983.
[2]MIL-STD: 1777 "Internet Protocol", August 1983.
[3]RFC 1166Kirkpatrick, S., M. Stahl, and M. Recker, "Internet Numbers", RFC 1166, DDN NIC, July 1990.July 1990