3. 地址映射
由于地址映射常常被视为服务要素值映射中最复杂的部分, 本教程为该主题单设一章.
RFC 822 和 X.400 都有各自特定的地址格式.RFC 822 地址是文本字符串 (例如 "[email protected]"), 而 X.400 地址是带有值的属性的二进制编码集合.这种二进制地址可以通过多种表示法变成人类用户可读的形式, 例如:
C=zz
ADMD=ade
PRMD=fhbo
O=a bank
S=plork
G=mary
本章其余部分更详细地讨论寻址问题以及两种地址形式之间的映射.
3.1. X.400 地址
如上所述, X.400 地址建模为一组属性.其中某些属性是强制性的, 另一些是可选的.每个属性都有类型和值, 例如 Surname 属性的类型为 IA5text, 该属性的一个实例可以具有值 "Kille".属性分为 Standard Attributes (SAs) 和 Domain Defined Attributes (DDAs).
X.400 定义了四种基本的地址形式 ([17], 18.5), 其中 "Mnemonic O/R Address" 是使用最多的形式, 也是本教程唯一处理的形式.这大致与 84 版中称为 "O/R
3.1.1. 标准属性
Standard Attributes (SAs) 是所有 X.400 安装都应当 "理解" (即用于路由) 的属性, 例如 "country name", "given name" 或 "organizational unit".X.400(84) 中最常用的 SAs 有:
surName (S)
givenName (G)
initials (I*) (Zero or more)
generationQualifier (GQ)
OrganizationalUnits (OU1 OU2 OU3 OU4)
OrganizationName (O)
PrivateDomainName (PRMD)
AdministrationDomainName (ADMD)
CountryName (C)
S, G, I* 和 GQ 的组合通常称为 PersonalName (PN).
尽管标准并未定义 (寻址权威机构的) 层次结构, 但以下层次结构被认为是自然的:
PersonalName < OU4 < OU3 < OU2 < OU1 < O < P < A < C
除了上面列出的 SAs 之外, X.400(88) 还定义了一些额外属性, 其中最重要的是
Common Name (CN)
CN 可以代替 PN 使用, 甚至可以与 PN 一起使用.X.400(84) 中的问题在于, PN (S G I* GQ) 非常适合表示人, 但不适合表示角色和抽象对象, 例如分发
列表.尽管 postmaster 显然是一个角色, 而不是某人的真实姓氏, 但在 X.400(84) 中用 S=postmaster 寻址 postmaster 十分常见.在 X.400(88) 中, 同一个 postmaster 将用 CN=postmaster 寻址.
C 和 ADMD 属性是强制性的 (即必须存在), 且不得为空.PRMD, O, OU, PN 和 CN 中至少有一个属性必须存在.
PRMD 和 ADMD 常常被认为是实际上不属于地址的路由属性.作为此类地址属性如何用于路由目的的一个示例, 考虑 ADMD 的两个特殊值:
- ADMD=0; (zero) should be interpreted as 'the PRMD in this
address is not connected to any ADMD'
- ADMD= ; (single SPACE) should be interpreted as 'the PRMD in
this address is reachable via any ADMD in this country'. It
is expected that ISO will express this 'any' value by means
of a missing ADMD attribute in future versions of MOTIS.
This representation can uniquely identify the meaning 'any',
as a missing or empty ADMD field as such is not allowed.
X.400 使用 Abstract Syntax Notation One (ASN.1) 定义地址.X.409 定义了如何将 ASN.1 中的定义编码为二进制格式.请注意, 缺失属性的含义, 从而其 ASN.1 编码, 与空属性的含义并不相同.在寻址中, 这种差异常用以下方式表示:
- PRMD=; means that this attribute is present in the address,
but its value is empty. Since this is not very useful, it's
hardly ever used. The only examples the author knows of
were caused by mail managers who should have had this
tutorial before they started defining their addresses :-)
- PRMD=@; means that this attribute is not present in the
address. {NB. This is only necessary if an address notation
(see 3.1.3) requires that every single attribute in the
hierarchy is somehow listed. Otherwise, a missing attribute
can of course be represented by simply not mentioning it.
This means that this syntax is mostly used in mapping rules,
not by end users.}
只包含 SAs 的地址通常称为 Standard Attribute Addresses (SAAs).
3.1.2. 域定义属性
Domain Defined Attributes (DDAs) 可以作为 Standard Attributes 的补充使用.一个 DDA 实例由类型和值组成.DDAs 旨在仅在特定上下文中具有含义 (最初这被认为是某个管理域的上下文, 因此得名 DDA), 例如公司上下文.
例如, 一家公司可能希望定义一个 DDA 来描述内线电话号码: DDA type=phone value=9571.
比较微妙的是使用 DDAs 编码仅存在于服务网关一侧的服务要素类型或值.此类用法最重要的示例定义于:
RFC 1327 (e.g., DDA type=RFC-822 value=u(u)ser(a)isode.com)
RFC 1328 (e.g., DDA type=CommonName value=mhs-discussion-list)
同时包含 SAs 和 DDAs 的地址通常称为 DDA 地址.
3.1.3. X.400 地址表示法
X.400 只规定地址的二进制编码, 并不标准化此类地址在纸上应如何书写, 或在计算机屏幕的用户界面中应呈现为何种形式.
不过, 存在一些关于 X.400 地址表示的推荐做法.
- JTC 提议为 CCITT Rec. F.401 和 ISO/IEC 10021-2 增加一份附件, 名为 "Representation of O/R addresses for human usage".根据该提议, X.400 地址将如下所示:
G=jo; S=plork; O=a bank; OU1=owe; OU2=you; P=fhbo; A=ade; C=zz
Note that in this format, the order of O and the OUs is exactly
the opposite of what one would expect intuitively (the attribute
hierarchy is increasing from left to right, except for the O and
OUs, where it's right to left. The reasoning behind this is that
this sequence is following the example of a postal address). This
proposal has been added (as a recommendation) to the 1992 version
of the standards.
- 沿用 DFN-EAN 软件最初使用的做法, 如今大多数 EAN 版本使用与 JTC 提议类似但略有差异的地址表示:
- natural ordering for O and OUs
- no numbering of OUs.
- allows writing ADMD and PRMD instead of A and P
上面示例中的地址在 EAN 中可以表示为:
G=jo; S=plork; OU=you; OU=owe; O=a bank; PRMD=fhbo; ADMD=ade; C=zz
这种 DFN-EAN 格式至今仍常被称为 the "readable format".
- RARE Working Group on Mail and Messaging (WG-MSG) 提出了一项与 DFN-EAN 格式非常相似但层次顺序相反的建议.此外, 它使用 ADMD 和 PRMD 代替 A 和 P.因此, 上述地址被表示为:
C=zz; ADMD=ade; PRMD=fhbo; O=a bank; OU=owe; OU=you; S=plork; G=jo
这种格式为大多数版本的 EAN 软件所识别.在研发群体中, 它是名片, 信笺抬头等场合最流行的地址表示之一.它也是本教程示例将使用的格式.
(注意, 此处用于描述 DDAs 的语法如下:
DD.'type'='value', 例如 DD.phone=9571)
- RFC 1327 定义了一种以斜杠分隔的地址表示:
/G=jo/S=plork/OU=you/OU=owe/O=a bank/P=fhbo/A=ade/C=zz/
这种格式不仅被 PP 软件使用, 在研发群体的名片和信笺抬头中也很普遍.
- RFC 1327 最后还为 X.400 domains 定义了另一种格式 (不是供人类用户使用):
OU$you.OU$owe.O$a bank.P$fhbo.A$ade.C$zz
这种格式的主要优点是比其它格式更便于机器解析, 这也立即意味着其主要缺点: 人类几乎无法阅读.层次结构中的每个属性都应列出, 因此缺失属性必须用 "@" 符号表示 (例如 $a [email protected]$ade.C$zz).
- Paul-Andre Pays (INRIA) 提出了一种格式, 它结合了 JTC 格式的可读性和 RFC 1327 域格式的可解析性.尽管 GO-
MHS 群体中已有一些运行工具基于该提议 (或其变体), 但其前景仍不确定.
3.2. RFC 822 地址
RFC 822 地址是具有以下形式的 ASCII 字符串:
localpart@domainpart
"domainpart" 被细分为
domainpart = sdom(n).sdom(n-1)....sdom(2).sdom(1).dom
"sdom" 代表 "subdomain", "dom" 代表 "top-level-domain".
"localpart" ;通常是一个登录名, 因而通常是姓氏或其缩写.它也可以指定一个本地分发列表.
RFC 822 地址中的 (寻址权威机构的) 层次结构如下:
localpart < sdom(n) < sdom(n-1) <...< dom
一些虚拟的真实例子:
在上面的例子中, "nl", "dk" 和 "edu" 是有效的, 已注册的顶级域.请注意, 一些拥有自身寻址方案的网络也可以通过 "RFC 822-like" 寻址到达.考虑以下地址:
oops!user (a UUCP address)
V13ENZACC@CZKETH5A (a BITNET address)
这些地址可以用 RFC 822 格式表示:
注意, 域 ".uucp" 和 ".bitnet" 没有已注册的 Internet 路由.此类地址必须始终路由到网关 (如何实现不在本教程范围内).
至于将这些地址映射到 X.400, 一方面 X.400 与另一方面的 UUCP 和 BITNET 之间没有定义直接映射, 因此它们通常先映射到 RFC 822 风格, 必要时再映射到 X.400.
3.3. RFC 1327 地址映射
尽管地址格式不同, RFC 822 和 X.400 定义的地址空间却非常相似.最重要的相似之处是:
- both address spaces are hierarchical
- top level domains and country codes are often the same
- localparts and surnames are often the same
这种相似性当然可以用于地址映射算法.RFC 1327 也这样做了 (注意, 仅在例外映射算法中.见第 3.3.2 章).
请注意, 实际映射算法比下面显示的复杂得多.详情请参阅 RFC 1327 第 4 章.
3.3.1. 默认映射
RFC 1327 默认地址映射可以可视化为一个带有输入和输出参数的函数:
address information of the gateway performing the mapping
|
v
+-----------------+
RFC 822 address <--->| address mapping | <---> X.400 address
+-----------------+
也就是说, 要将地址从 X.400 映射到 RFC 822 或反之, 唯一需要的额外输入是本地网关的地址信息.
3.3.1.1. X.400 -> RFC 822
从 X.400 到 RFC 822 的默认地址映射有两种: 一种是将真实 X.400 地址映射到 RFC 822, 另一种是解码已被映射到 X.400 的 RFC 822 地址 (即逆转默认的 RFC 822 -> X.400 映射).
要将真实 X.400 地址映射到 RFC 822, X.400 地址的斜杠分隔表示 (见第 3.1 章) 被映射到 "localpart", 执行映射的网关的本地 RFC 822 域用作域部分.例如, 网关 "gw.switch.ch" 将执行以下映射:
C=zz; ADMD=ade; PRMD=fhbo; O=tlec; S=plork; ->
/C=zz/ADMD=ade/PRMD=fhbo/O=tlec/S=plork/@gw.switch.ch
C=zz; ADMD=ade; PRMD=fhbo; O=a bank; S=plork->
"/C=zz/ADMD=ade/PRMD=fhbo/O=a bank/S=plork/"@gw.switch.ch
如果 X.400 地址包含空格, 第二个示例中的引号是强制性的, 否则会违反 RFC 822 localpart 的语法规则.
该默认映射算法通常称为 "left-hand-side encoding".
要逆转默认的 RFC 822 -> X.400 映射 (见第 3.3.1.2 章): 如果 X.400 地址包含类型为 RFC-822 的 DDA, 可以丢弃 SAs, 该 DDA 的值就是所需的 RFC 822 地址 (注意, DDA 值中的某些字符必须先解码.见第 3.3.1.2 章).例如, 网关
DD.RFC-822=bush(a)dole.us; C=nl; ADMD=tlec; PRMD=GW
->
[email protected]
3.3.1.2. RFC 822 -> X.400
从 RFC 822 到 X.400 的默认地址映射也有两种: 一种是将真实 RFC 822 地址映射到 X.400, 另一种是解码已被映射到 RFC 822 的 X.400 地址 (即逆转默认的 X.400 -> RFC 822 映射).
要将真实 RFC 822 地址映射到 X.400, 该 RFC 822 地址被编码到一个类型为 RFC-822 的 DDA 中, 并加上执行映射的本地网关的 SAs 以构成完整的 X.400 地址.
这种映射通常称为 "DDA mapping".例如, 网关 "C=nl; ADMD=tlec; PRMD=GW" 将执行以下映射:
[email protected] ->
DD.RFC-822=bush(a)dole.us; C=nl; ADMD=tlec; PRMD=GW
关于 RFC 822 地址在 DDAs 中的编码与解码, 需要指出, RFC 822 地址可能包含无法在 DDA 中直接表示的字符 (@ ! % 等).DDAs 属于受限字符集类型 "PrintableString", 它是 IA5 (=ASCII) 的子集.不属于该集的字符需要特殊编码.一些示例 (详情请参阅 RFC 1327 第 3.4 章):
100%name@address -> DD.RFC-822;=100(p)name(a)address
u_ser!name@address -> DD.RFC-822;=u(u)ser(b)name(a)address
要解码已被映射到 RFC 822 的 X.400 地址: 如果 RFC 822 地址的 localpart 中含有完整 X.400 mnemonic O/R 地址的斜杠分隔表示, 该地址就是映射结果.例如, 网关 "gw.switch.ch" 将执行以下映射:
/C=zz/ADMD=ade/PRMD=fhbo/O=tlec/S=plork/G=mary/@gw.switch.ch
->
C=zz; ADMD=ade; PRMD=fhbo; O=tlec; S=plork; G=mary
3.3.2. 依照映射表的例外映射
第 3.3.1 章表明, 理论上可以只使用默认映射来使用 RFC 1327.尽管这提供了一种非常简单直接的映射地址的方法, 但有充分理由不以这种方式使用 RFC 1327:
- RFC 822 users are used to writing simple addresses of the
form 'localpart@domainpart'. They often consider X.400
addresses, and thus also the left-hand-side encoded
equivalents, as unnecessarily long and complicated. They
would rather be able to address an X.400 user as if she had a
'normal' RFC 822 address. For example, take the mapping
C=zz; ADMD=ade; PRMD=fhbo; O=tlec; S=plork; ->
/C=zz/ADMD=ade/PRMD=fhbo/O=tlec/S=plork/@gw.switch.ch
from chapter 3.3.1.1. RFC 822 users would find it much more
'natural' if this address could be expressed in RFC 822 as:
- X.400 users are used to using X.400 addresses with SAs only.
They often consider DDA addresses as complicated, especially
if they have to encode the special characters, @ % ! etc,
manually. They would rather be able to address an RFC 822
user as if he had a 'normal' X.400 address. For example, take
the mapping
[email protected]
->
DD.RFC-822=bush(a)dole.us;
C=nl; ADMD= ; PRMD=tlec; O=gateway
from chapter 3.3.1.2. X.400 users would find it much more
'natural' if this address could be expressed in X.400 as:
C=us; ADMD=dole; S=bush
- Many organisations are using both RFC 822 and X.400
internally, and still want all their users to have a simple,
unique address in both mail worlds. Note that in the default
mapping, the mapped form of an address completely depends on
which gateway performed the mapping. This also results in a
complication of a more technical nature:
- The tricky 'third party problem'. This problem need not
necessarily be understood to read the rest of this chapter.
If it looks too complicated, please feel free to skip it
until you are more familiar with the basics.
The third party problem is a routing problem caused by
mapping. As an example for DDA mappings (the example holds
just as well for left-hand-side encoding), consider the
following situation (see Fig. 3.1.): RFC 822 user X in
country A sends a message to two recipients: RFC 822 user Y,
and X.400 user Z, both in country B:
From: X@A
To: Y@B ,
/C=B/.../S=Z/@GW.A
Since the gateway in country A maps all addresses in the
message, Z will see both X's and Y's address as DDA-encoded
RFC 822 addresses, with the SAs of the gateway in country A:
From: DD.RFC-822=X(a)A; C=A;....;O=GW
To: DD.RFC-822=Y(a)B; C=A;....;O=GW ,
C=B;...;S=Z
| ------------ ---------
| |X: RFC 822|<------->|gateway|
| ------------ ---------
| A | ^
\ | |
\---------------------------------------------
| |
/---------------------------------------------
/ | |
| B | v
| | -----------
| | |Z: X.400 |
| | -----------
| | .
| | .
| | .
| | .
| | .
| v v
| ------------ ---------
| |Y: RFC 822|<........|gateway|
| ------------ ---------
Fig. 3.1 The third party problem
Now if Z wants to 'group reply' to both X and Y, his reply to Y
will be routed over the gateway in country A, even though Y is
located in the same country:
From: C=B;...;S=Z
To: DD.RFC-822=Y(a)B; C=A;....;O=GW ,
DD.RFC-822=X(a)A; C=A;....;O=GW
The best way to travel for a message from Z to Y would of
course have been over the gateway in country B:
From: C=B;...;S=Z
To: DD.RFC-822=Y(a)B; C=B;....;O=GW ,
DD.RFC-822=X(a)A; C=A;....;O=GW
The third party problem is caused by the fact that routing
information is mapped into addresses.
Ideally, the third party problem shouldn't exist. After all,
address mapping affects addresses, and an address is not a
route.... The reality is different however. For instance, very
few X.400 products are capable to route messages on the
contents of a DDA (actually, only RFC 1327 gateways will be
able to interpret this type of DDA, and who says that the reply
will pass a local gateway on its route back?). Similar
limitations hold for the other direction: an RFC 822 based
mailer is not even allowed (see [5]) to make routing decisions
of the content of a left-hand-side encoded X.400 address if the
domain part is not its own. So in practice, addressing and
(thus also mapping) will very well affect routing.
为了使地址映射对用户更友好, 并避免上述问题, RFC 1327 允许覆盖默认的 left-hand-side encoding 和 DDA 映射算法.这是通过在某些 domainparts 与 X.400 域之间指定关联 (映射规则) 来实现的.一个 X.400 域 (就我们的目的而言, CCITT 的定义更窄...) 由 mnemonic O/R 地址中与域相关的 SAs 组成 (即除 PN 和 CN 之外的所有 SAs).其思路是利用两个地址空间之间的相似性, 将相似的地址部分直接相互映射.如果对于要映射的地址中的域可以找到一条显式映射规则, 则映射在以下两者之间执行:
localpart <-> PersonalName
domainpart <-> X.400 domain
只有在找不到映射规则时, 也就是地址映射必须回退到其默认算法时, 网关的地址信息才用作输入参数.
因此, 完整的映射函数可以如下图所示:
address information of the gateway performing the mapping
|
v
+-----------------+
RFC 822 address <--->| address mapping | <---> X.400 address
+-----------------+
^
|
domain associations (mapping rules)
3.3.2.1. PersonalName 和 localpart 映射
由于这些地址部分之间的映射与所使用的映射规则无关, 并且因为它遵循简单的双向算法方法, 因此首先在一个单独的子章节中讨论该主题.
X.400 PersonalName 由 givenName, initials 和 surName 组成.RFC 1327 假定不使用 generationQualifier.
要将 localpart 映射到 X.400 PN, 需要扫描 localpart 中的点, 这些点被视为 PN 各组成部分之间以及单个 initials 之间的分隔符.为了不在本教程中加入过多细节, 这里只展示几个示例.详细算法见 RFC 1327 第 4.2.1 章.
Marshall.Rose <-> G=Marshall;S=Rose
M.T.Rose <-> I=MT;S=Rose
Marshall.M.T.Rose <-> G=Marshall;I=MT;S=Rose
要将 X.400 PN 映射到 RFC 822 localpart, 取非空的 PN 属性, 按它们的层次顺序 (G I* S) 排列, 并用句点连接.
有些例外是由于 left-hand-side encoding 也可以与例外映射混合使用造成的.后续子章节将更详细地说明这一点.
3.3.2.2. X.400 域和 domainpart 映射
一条映射规则关联两个域: 一个 X.400 域和一个 RFC 822 域.X.400 域以 RFC 1327 域表示法书写 (见 3.1.3), 因此两个域具有相同的层次顺序.
这些域写在一行上, 用 "#" 符号分隔.例如:
arcom.ch#ADMD$arcom.C$ch#
PRMD$tlec.ADMD$ade.C$nl#tlec.nl#
一条映射规则必须至少包含一个顶级域和一个国家代码.如果需要映射一个地址, 则寻找具有最长域匹配的映射规则.映射规则中关联的域用作映射后地址的域.其余域按照自然层次逐一映射.具体示例见后续子章节.
3.3.2.2.1. X.400 -> RFC 822
作为示例, 假设定义了以下映射规则:
PRMD$tlec.ADMD$ade.C$nl#tlec.nl#
那么地址 C=nl; ADMD=ade; PRMD=tlec; O=you; OU=owe; S=plork
S OU O PRMD ADMD Country
| | | | | |
plork owe you tlec ade nl
将按如下方式映射.Surname "plork" 映射到 localpart "plork", 见第 3.3.2.1 章.域
localpart
| sdom3
| | sdom2
| | | sdom1
| | | | top-level-domain
| | | | |
plork@ tlec.nl
其余 SAs (O 和一个 OU) 按照自然层次逐一映射: O 映射到 sdom2, OU 映射到 sdom3:
localpart
| sdom3
| | sdom2
| | | sdom1
| | | | top-level-domain
| | | | |
[email protected]
因此, 映射后的地址是:
包含所有此类映射规则列表的表会分发给全球所有网关, 通常称为 "mapping table 1".其它常用文件名 (也取决于您使用的软件) 有:
'or2rfc'
'mapping 1'
'map1'
'table 1'
'X2R'
如前面已经预告, 有一种例外情况, 即 localpart 和 PN 并不直接相互映射: 有时有必要将 localpart 用于其它目的.如果 X.400 地址包含的属性不允许简单映射:
localpart <-> PersonalName
domainpart <-> X.400 domain
(例如, RFC 822 域中不允许空格, GQ 和 CN 不能直接映射到 localpart, RFC-822 之外其它类型的 DDAs), 则这些属性连同 PN 一起进行 left-hand-side encoding.domainpart 仍须尽可能按照映射规则进行映射.这可能需要一些例子:
C=nl; ADMD=ade; PRMD=tlec; O=owe; OU=you; S=plork; GQ=jr
->
/S=plork/GQ=jr/@you.owe.tlec.nl
C=nl; ADMD=ade; PRMD=tlec; O=owe; OU=spc ctr; OU=u; S=plork
->
"/S=plork/OU=u/OU=spc ctr/"@owe.tlec.nl
请注意, 在第二个示例中, "O=owe" 仍按照自然层次映射为一个子域.问题出在 "OU=spc ctr" 中的空格.
3.3.2.2.2. RFC 822 -> X.400
作为示例, 假设定义了以下映射规则:
tlec.nl#PRMD$tlec.ADMD$ade.C$nl#
那么地址 "[email protected]":
localpart
| sdom3
| | sdom2
| | | sdom1
| | | | top-level-domain
| | | | |
[email protected]
将按如下方式映射.
localpart "plork" 映射到 "S=plork", 见第 3.3.2.1 章.
域 "tlec.nl" 按照映射规则映射:
S OU OU O PRMD ADMD Country
| | | |
plork tlec ade nl
其余域 (owe.you) 按照自然
层次逐一映射: sdom2 映射到 O, sdom3 映射到 OU:
S OU OU O PRMD ADMD Country
| | | | | |
plork | | tlec ade nl
owe you
因此, 映射后的地址是 (以可读表示法):
C=nl; ADMD=ade; PRMD=tlec; O=you; OU=owe; S=plork
如果 localpart 中存在未表示完整 mnemonic O/R 地址的 left-hand-side encoded SAs, 则该 localpart 将映射到那些 SAs.例如:
"/S=plork/GQ=jr/OU=u/OU=spc ctr/"@owe.tlec.nl
->
C=nl; ADMD=ade; PRMD=tlec; O=owe; OU=space ctr;
OU=u; S=plork; GQ=jr
这是逆转 localpart 的特殊用法所必需的, 该用法对某些属性进行 left-hand-side encode.见 3.3.2.2.1.
此时您可能会问, 为什么根本需要这样的规则.为什么不直接在另一个方向使用 map1? 问题在于, 对称映射函数 (双射) 固然理想, 但并不可行.非对称映射的存在有若干原因:
- To make sure that uucp addresses etc. get routed over local
gateways.
- Preferring certain address forms, while still not forbidding
others to use another form. Examples of such reasons are:
- Phasing out old address forms.
- If an RFC 822 address is mapped to ADMD= ; it means that
the X.400 mail can be routed over any ADMD in that
country. One single ADMD may of course send out an
address containing: ADMD=ade; . It must also be possible
to map such an address back.
因此我们确实也需要从 RFC 822 到 X.400 的映射规则.包含所有此类映射规则列表的表会分发给全球所有网关, 通常称为 "mapping table 2".其它常用文件名 (也取决于您使用的软件) 有:
'rfc2or'
'mapping 2'
'map2'
'table 2'
'R2X'
如果 RFC 822 localpart 和/或 domainpart 包含不能直接适合 PN 属性值的字符 (! % _), 映射算法将回退到 DDA 映射.在这种情况下, 将要使用的 SAs 仍通过按照映射规则映射 domainpart 来确定.在我们的例子中:
100%[email protected]
->
DD.RFC-822=100(p)user(a)work.tlec.nl;
C=nl; ADMD=ade; PRMD=tlec; O=work
如果找不到 map2 规则, 则扫描第三张规则表: 网关表.该表的语法与映射表 2 相同, 但语义不同.首先, 仅在网关表中有条目的域总是被映射为一个 RFC 822 DDA.对于纯基于 RFC 822, 但其邮件可能经由 X.400 网络中继的域, 网关表将该域与 X.400 消息应路由到的网关的 SAs 关联起来.然后, 该网关负责将消息网关回 RFC 822 世界.例如, 如果我们有网关表条目:
gov#PRMD$gateway.ADMD$Internet.C$us#
(并且我们假定不存在针对顶级域 "gov" 的覆盖性 map2 规则), 这将强制所有网关执行以下映射:
[email protected]
->
DD.RFC-822=bush(a)dole.gov;
C=us; ADMD=Internet; PRMD=gateway
这与默认的 DDA 映射非常相似, 只是 SAs 属于某个已声明对特定 RFC 822 域负责的网关, 而不是本地网关.因此, 该机制有助于避免第 3.2.2 章讨论的第三方问题.
包含所有此类网关规则列表的表会分发给全球所有网关, 通常称为 "gateway table".其它常用文件名 (也取决于
您使用的软件) 有:
'rfc1148gate' {From the predecessor of RFC 1327, RFC 1148}
'gate table'
'GW'
只有当一个域完全没有定义规则 (map2 或网关规则) 时, 算法才会回退到 3.3.1.2 中描述的默认 DDA 映射.
3.4. 表协调
如前所述, 只有当全球所有网关使用相同的映射表时, 使用映射表才能顺利运作.在全球层面, RFC 1327 地址映射表的收集和分发由 MHS Co-ordination Service 协调:
SWITCH Head Office
MHS Co-ordination Service
Limmatquai 138
CH-8001 Zurich, Europe
Tel. +41 1 268 1550
Fax. +41 1 268 1568
RFC 822: [email protected]
X.400: C=ch;ADMD=arcom;PRMD=switch;O=switch;S=project-team;
映射规则的收集和分发过程可在 MHS Co-ordination Server 的 "/procedures" 目录中找到.附录 D 描述了如何访问该服务器.
如果您想为自己本地的域定义映射规则, 可以在同一服务器的 "/mhs-services" 目录中找到您所在国家或网络 (网关管理员) 的合适联系人.
3.5. 本地增补
由于某些网络希望定义仅在其网络内部使用的规则, 此类规则不应全球分发.考虑两个网络都希望通过各自的本地网关到达旧的顶级域 "arpa".它们都希望为此使用一条映射 2 规则:
TLec in NL: arpa#PRMD$gateway.ADMD$tlec.C$nl#
SWITCH in CH: arpa#PRMD$gateway.ADMD$switch.C$ch#
(您可能已经正确地注意到, 它们本应在网关表中定义此类规则, 但为了举例, 我们假定它们将其定义在映射表 2 中.这是 RFC 987 时代的做法, 如今许多网络仍然这样做.)
由于一张映射表不能包含两条左侧具有相同域的映射规则, 这类 "local mappings" 不会在全球分发.存在一份 RARE 草案提议 [13], 它定义了一种允许并自动处理冲突映射规则的机制, 但迄今为止该机制尚未实现.在从 MHS Co-ordination Service 收到全球映射表之后, 许多网络会在将表安装到网关之前, 向 map2 和网关表添加 "local" 规则.请注意, 此类本地映射的反向映射 2 规则 是 全局唯一的, 因此可以全球分发.这甚至是必要的, 因为使用本地映射规则映射的地址可能泄漏到其他网络 (第三方问题又来了...).这些其它网络至少应被提供将地址映射回来的可能性.因此, 在这种情况下, 全局映射表 1 将包含以下两条规则:
PRMD$gateway.ADMD$tlec.C$nl#arpa#
PRMD$gateway.ADMD$switch.C$ch#arpa#
请注意, 如果此类规则本应定义为本地网关表条目而不是 map2 条目, 就无需在全球分发反向映射 (DDA 编码的 RFC 822 地址的反向映射只需剥离 SAs 即可, 见 3.3.1.1.).
3.6. 产品特定格式
并非所有软件都在内部使用 RFC 1327 格式的映射表.几乎所有格式都允许以 # 符号开头的行作为注释.不同格式的一些示例:
RFC 1327
# This is pure RFC 1327 format
# table 1: X.400 -> RFC 822
#
PRMD$tlec.ADMD$ade.C$nl#tlec.nl#
# etc.
# table 2: RFC 822 -> X.400
#
arcom.ch#ADMD$arcom.C$ch#
# etc.
EAN
# This is EAN format
# It uses the readable format for X.400 domains and TABs
# to make a 'readable mapping table format'.
# table 1: X.400 -> RFC 822
#
P=tlec; A=ade; C=nl; # tlec.nl
# etc.
# table 2: RFC 822 -> X.400
#
arcom.ch # A=arcom; C=ch;
# etc.
PP
# This is PP format
# table 1: X.400 -> RFC 822
#
PRMD$tlec.ADMD$ade.C$nl:tlec.nl
# etc.
# table 2: RFC 822 -> X.400
#
arcom.ch:ADMD$arcom.C$ch
# etc.
大多数研发网络都有工具, 可从原始 RFC 1327 表自动生成这些格式; 有些甚至在网络内以多种格式分发这些表.如果您需要特定格式的映射表, 请联系您所在国家或研发网络的网关管理员.见第 3.4 章.
3.7. 映射规则定义指南
请注意, 在不了解自己在做什么的情况下定义映射规则, 不仅可能对您的网络, 也可能对其他网络造成灾难性后果.如果至少遵循以下规则, 您应该相当安全:
- First of all, read this tutorial;.
- Avoid local mappings; prefer gate table entries. (See chapter
3.5)
- Make sure any domain you map to can also be mapped back;.
- Aim for symmetry.
- Don't define a gateway table entry if the same domain already
has a map2 entry. Such a rule would be redundant.
- Map to "ADMD=0;" if you will not be connected to any ADMD for
the time being.
- Only map to "ADMD= ;" if you are indeed reachable through
_any_ ADMD in your country.
- Mind the difference between "PRMD=;" and "PRMD=@;" and make
sure which one you need. (Try to avoid empty or unused
attributes in the O/R address hierarchy from the beginning!)
- Don't define mappings for domains over which you have no
naming authority.
- Before defining a mapping rule, make sure you have the
permission from the naming authority of the domain you want
to map to. Normally, this should be the same organisation as
the mapping authority of the domain in the left hand side of
the mapping rule. This principle is called 'administrative
equivalence'.
- Avoid redundant mappings. E.g., if all domains under 'tlec.nl'
are in your control, don't define:
first.tlec.nl#O$first.PRMD$tlec.ADMD$ade.C$nl#
last.tlec.nl#O$last.PRMD$tlec.ADMD$ade.C$nl#
always.tlec.nl#O$always.PRMD$tlec.ADMD$ade.C$nl#
but rather have only one mapping rule:
tlec.nl#PRMD$tlec.ADMD$ade.C$nl#
- Before introducing a new mapped version of a domain, make
sure the world can route to that mapped domain;.
E.g., If you are operating a PRMD: C=zz; ADMD=ade; PRMD=ergo;
and you want to define the mapping rules:
map1: PRMD$ergo.ADMD$ade.C$zz#ergo.zz#
map2: ergo.zz#PRMD$ergo.ADMD$ade.C$zz#
Make sure that ergo.zz (or at least all of its subdomains) is
DNS routeable (register an MX or A record) and will be routed
to a gateway that agreed to route the messages from the
Internet to you over X.400.
In the other direction, if you are operating the Internet
domain cs.woodstock.edu, and you want to define a mapping for
that domain:
map2: cs.woodstock.edu#O$cs.PRMD$woodstock.ADMD$ .C$us#
map1: O$cs.PRMD$woodstock.ADMD$ .C$us#cs.woodstock.edu#
Make sure that C=us; ADMD= ; PRMD=woodstock; O=cs; (or at
least all of its subdomains) is routeable in the X.400 world,
and will be routed to a gateway that agreed to route the
messages from X.400 to your RFC 822 domain over SMTP. Within
the GO-MHS community, this would be done by registering a
line in a so-called domain document, which will state to
which mail relay this domain should be routed.
Co-ordinate any such actions with your national or MHS'
gateway manager. See chapter 3.4.