JP4019848B2 - Address translation device - Google Patents
Address translation device Download PDFInfo
- Publication number
- JP4019848B2 JP4019848B2 JP2002226960A JP2002226960A JP4019848B2 JP 4019848 B2 JP4019848 B2 JP 4019848B2 JP 2002226960 A JP2002226960 A JP 2002226960A JP 2002226960 A JP2002226960 A JP 2002226960A JP 4019848 B2 JP4019848 B2 JP 4019848B2
- Authority
- JP
- Japan
- Prior art keywords
- port
- port number
- network
- address
- address translation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Images
Description
【発明の属する技術分野】
本発明は、広域ネットワークと構内ネットワークとを接続するアドレス変換装置ならびにこのアドレス変換装置におけるポート番号差替え方法およびポート番号割当て方法に関する。
【0001】
【従来の技術】
インターネット接続などに使用されるTCP/IP(Transmission Control Protocol/Internet Protocol)と呼ばれるプロトコルでは、ネットワーク層においてIP(Internet Protocol)プロトコルが使用され、トランスポート層においてTCP(Transmission Control Protocol)プロトコルまたはUDP(User Datagram Protocol)プロトコルが使用される。IPプロトコルにおいては、コンピュータ間でデータをやりとりする際にIPアドレスと呼ばれる32ビット(IPv4の場合)のアドレスが使用される。また、TCPプロトコルおよびUDPプロトコルでは、アプリケーションごとのデータを区別するためにポートと呼ばれるデータの出入り口が決められている。
【0002】
広域ネットワーク(WAN:ワイドエリアネットワーク、例えば、インターネット)と構内ネットワーク(LAN:ローカルエリアネットワーク)とを接続するアドレス変換装置は、広域ネットワークにおけるアドレスと構内ネットワークにおけるアドレスとを相互に変換する。上述のように、TCP/IPプロトコルではネットワーク上のコンピュータおよびアプリケーションを特定するためにIPアドレスおよびポート番号が使用されるため、アドレス変換装置の多くはこれらIPアドレスおよびポート番号を変換する機能を採用している。このIPアドレスおよびポート番号の変換機能は、NAPT(Network Address Port Translation)、ENAT(Enhanced Network Address Translation)またはIPマスカレードなどと呼ばれる。一方、IPアドレスだけを変換する機能は、NAT(Network Address Translation)などと呼ばれる。本出願におけるアドレス変換とは、これらNATおよびNAPTなどを含む広義のアドレス変換を意味するものとする。
【0003】
アドレス変換装置を介して構内ネットワーク上のサーバを広域ネットワークに接続する場合、広域ネットワークからサーバにアクセスするための広域IPアドレス(以下、グローバルIPアドレスという。)と広域ポート番号(以下、グローバルポート番号という。)とを知らせておく必要がある。アドレス変換装置は、広域ネットワーク上の端末(クライアント)からサーバへのパケットを受けて、送信先のグローバルIPアドレスおよびグローバルポート番号をサーバの構内IPアドレス(以下、ローカルIPアドレスという。)および構内ポート番号(以下、ローカルポート番号という。)にそれぞれ変換する。また、アドレス変換装置は、サーバから広域ネットワーク上の端末へのパケットについて、送信元のローカルIPアドレスおよびローカルポート番号をグローバルIPアドレスおよびグローバルポート番号にそれぞれ変換する。
【0004】
【発明が解決しようとする課題】
上述の従来技術では、広域ネットワークからサーバにアクセスするためのグローバルIPアドレスおよびグローバルポート番号が固定されていることを前提としている。しかしながら、動的にポート番号を生成して通信を行うプロトコルも存在する。例えば、インターネット放送に使用されるRTSP(Real Time Streaming Protocol)プロトコルでは、一旦サーバにアクセスしてストリーミング用のポート番号を生成した後で、そのポート番号を使用してストリーミングを行うようになっている。この場合、構内で生成されたポート番号はアプリケーション層のRTSPプロトコルにおいて交換されるため、従来のアドレス変換装置の変換対象とならず、ローカルポート番号そのものが広域ネットワークに通知されることになる。通常はローカルポート番号とグローバルポート番号とは別個のものであるため、広域ネットワーク側からローカルポート番号を使用してもアクセスが許可されない。また、ポート番号を変換せずローカルポート番号とグローバルポート番号を同じものとした場合には、構内ネットワークに接続する複数のサーバ間でポート番号が重複するおそれがある。
【0005】
本発明の目的は、構内ネットワーク上のサーバへのポート割当て要求に対してグローバルポート番号を動的に取得して割り当てることにある。
【0006】
【課題を解決するための手段】
上記課題を解決するために本発明のアドレス変換装置は、第1のネットワーク(例えば、広域ネットワーク)と第2のネットワーク(例えば、構内ネットワーク)とを接続するアドレス変換装置であって、トランスポート層より高位のプロトコルにおいて交換される上記第2のネットワークの第2のポート番号(例えば、構内ポート番号)を上記第1のネットワークの第1のポート番号(例えば、広域ポート番号)に差し替える。これにより、第2のネットワーク上のサーバへのポート割当て要求に対して第1のポート番号を動的に割り当てるという作用をもたらす。
【0007】
また、本発明の他のアドレス変換装置は、上記プロトコルにおけるポート割当て要求に応答して上記第1のポート番号を取得して割り当てる。これにより、アドレス変換装置において動的に生成した第1のポート番号を割り当てるという作用をもたらす。
【0008】
また、本発明の他のアドレス変換装置は、第1のネットワークと第2のネットワークとを接続するアドレス変換装置であって、トランスポート層より高位のプロトコルにおいて交換される上記第2のネットワークの第2のポート番号を上記第2のネットワークのパケットから抽出するパケット解析手段と、上記第2のポート番号を上記第1のネットワークの第1のポート番号に差し替えて第1のネットワークへのパケットを生成する通信手段とを備える。これにより、トランスポート層より高位のプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0009】
また、本発明の他のアドレス変換装置において、上記プロトコルはTCPプロトコルより高位のプロトコルである。すなわち、TCPプロトコルより高位のプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0010】
また、本発明の他のアドレス変換装置において、上記プロトコルはUDPプロトコルより高位のプロトコルである。すなわち、UDPプロトコルより高位のプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0011】
また、本発明の他のアドレス変換装置において、上記プロトコルはアプリケーション層のプロトコルである。すなわち、アプリケーション層のプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0012】
また、本発明の他のアドレス変換装置において、上記プロトコルはHTTPプロトコルである。すなわち、HTTPプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0013】
また、本発明の他のアドレス変換装置において、上記プロトコルはRTSPプロトコルである。すなわち、RTSPプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0014】
また、本発明の他のアドレス変換装置において、上記プロトコルはSIPプロトコルである。すなわち、SIPプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0015】
また、本発明の他のアドレス変換装置は、上記第1のネットワークからのポート割当て要求を受けて上記第1のポート番号を取得して割り当てるポート割当て処理手段をさらに具備する。これにより、アドレス変換装置において動的に生成した第1のポート番号を割り当てるという作用をもたらす。
【0016】
また、本発明の他のアドレス変換装置において、上記ポート割当て処理手段は、アドレス変換テーブルにおいて既に設定されている第1のポート番号を検索する設定ポート検索手段と、この設定ポート検索手段により設定されていないことが確認された第1のポート番号の中から上記割当て要求におけるポート数に従って第1のポート番号を取得する制御手段とを具備する。これにより、設定済みの第1のポート番号を割り当てることを回避するという作用をもたらす。
【0017】
また、本発明の他のアドレス変換装置は、上記ポート割当て処理手段は、アドレス変換テーブルにおいて既に設定されている第1のポート番号を検索する設定ポート検索手段と、ポート状態テーブルにおいて既に使用されている第1のポート番号を検索する使用中ポート検索手段と、上記設定ポート検索手段により設定されていないことが確認され且つ上記使用中ポート検索手段により使用されていないことが確認された第1のポート番号の中から上記割当て要求におけるポート数に従って第1のポート番号を取得する制御手段とを具備する。これにより、設定済みまたは使用中の第1のポート番号を割り当てることを回避するという作用をもたらす。
【0018】
また、本発明の他のアドレス変換装置において、上記割当て要求は、割り当てる第1のポート番号の開始番号の指定の有無を含み、上記制御手段は、上記開始番号の指定が無い場合にはポート初期値を乱数により発生して、このポート初期値を開始番号として第1のポート番号を取得する。これにより、ポート初期値から規則性を取り除き、セキュリティレベルを向上させるという作用をもたらす。
【0019】
また、本発明の他のアドレス変換装置において、上記割当て要求は、割り当てる第1のポート番号の開始番号の指定を含み、上記制御手段は、上記割当て要求に含まれる開始番号から第1のポート番号を取得する。これにより、アプリケーションの仕様に応じたポート番号を割り当てるという作用をもたらす。
【0020】
また、本発明の他のアドレス変換装置において、上記ポート割当て処理手段は、取得対象となる第1のポート番号の最小値と最大値とを保持するポート定義ファイルをさらに具備し、上記制御手段は、上記ポート定義ファイルにおける上記最小値から上記最大値の範囲において上記第1のポート番号の取得を行う。これにより、任意の範囲において第1のポート番号の割当てを実現するという作用をもたらす。
【0021】
また、本発明の他のアドレス変換装置において、上記割当て要求は、割り当てる第1のポート番号の開始番号の指定を含み、上記制御手段は、上記割当て要求に含まれる開始番号が上記最小値から上記最大値の範囲にあるか否かを判断して、上記最小値から上記最大値の範囲にあれば上記開始番号から第1のポート番号を取得し、上記最小値から上記最大値の範囲になければ開始番号指定エラーを通知する。これにより、指定された第1のポート番号の開始番号を適切なものに保つという作用をもたらす。
【0022】
また、本発明の他のアドレス変換装置において、上記割当て要求は、割り当てる第1のポート番号を連続番号に限るか否かの指定を含み、上記制御手段は、上記割当て要求が上記連続番号に限る旨の指定を含む場合には第1のポート番号として連続番号を取得できなければ取得失敗とし、上記割当て要求が上記連続番号に限る旨の指定を含まない場合には連続番号を取得できなければ非連続番号の取得を行う。これにより、アプリケーションの仕様に応じた第1のポート番号を割り当てるという作用をもたらす。
【0023】
また、本発明の他のアドレス変換装置は、上記第2のネットワークに接続されるサーバの記憶領域のコピーを保持するプロキシ記憶手段と、このプロキシ記憶手段を参照して、上記割当て要求におけるポート数に従い第2のポート番号を取得して上記第2のネットワークのパケットを生成するサーバ代理手段とをさらに具備する。これにより、アドレス変換装置自身で第2のポート番号を割り当てるという作用をもたらす。
【0024】
また、本発明のポート番号差替え方法は、トランスポート層より高位のプロトコルにおいて交換される第2のネットワークの第2のポート番号を上記第2のネットワークのパケットから抽出する手順と、上記第2のポート番号を第1のネットワークの第1のポート番号に差し替えて上記第1のネットワークへのパケットを生成する手順とを具備する。これにより、トランスポート層より高位のプロトコルにおいて交換される第2のポート番号を第1のポート番号に差し替えて第1のネットワークへ通知するという作用をもたらす。
【0025】
また、本発明の他のポート番号差替え方法は、トランスポート層より高位のプロトコルにおいて交換される第2のネットワークの第2のポート番号を上記第2のネットワークのパケットから抽出する手順と、第1のネットワークの第1のポート番号を取得して割り当てる手順と、上記第2のポート番号を上記第1のポート番号に差し替えて上記第1のネットワークへのパケットを生成する手順とを具備する。これにより、アドレス変換装置において動的に生成した第1のポート番号を通知するという作用をもたらす。
【0026】
また、本発明のポート番号割当て方法は、第1のネットワークからポート割当て要求を受ける手順と、アドレス変換テーブルにおいて既に設定されている第1のポート番号を検索する手順と、上記アドレス変換テーブルにおいて既に設定されていない第1のポート番号の中から上記割当て要求におけるポート数に従って第1のポート番号を取得して割り当てる手順とを具備する。これにより、設定済みの第1のポート番号を割り当てることを回避するという作用をもたらす。
【0027】
また、本発明の他のポート番号割当て方法は、第1のネットワークからポート割当て要求を受ける手順と、アドレス変換テーブルにおいて既に設定されている第1のポート番号を検索する手順と、ポート状態テーブルにおいて既に使用されている第1のポート番号を検索する手順と、上記アドレス変換テーブルにおいて既に設定されていなく且つ上記ポート状態テーブルにおいて既に使用されていない第1のポート番号の中から上記割当て要求におけるポート数に従って第1のポート番号を取得して割り当てる手順とを具備する。これにより、設定済みまたは使用中の第1のポート番号を割り当てることを回避するという作用をもたらす。
【0028】
また、本発明の他のポート番号割当て方法は、第1のネットワークからポート割当て要求を受ける手順と、ポート初期値を乱数により発生する手順と、アドレス変換テーブルにおいて既に設定されている第1のポート番号を検索する手順と、ポート状態テーブルにおいて既に使用されている第1のポート番号を検索する手順と、上記アドレス変換テーブルにおいて既に設定されていなく且つ上記ポート状態テーブルにおいて既に使用されていない第1のポート番号の中から上記割当て要求におけるポート数に従って上記ポート初期値を開始番号として第1のポート番号を取得して割り当てる手順とを具備する。これにより、ポート初期値から規則性を取り除き、セキュリティレベルを向上させるという作用をもたらす。
【0029】
また、本発明の他のポート番号割当て方法において、上記第1のポート番号を取得する手順は、ポート定義ファイルに保持された取得対象となる第1のポート番号の最小値から最大値の範囲において上記第1のポート番号の取得を行う。これにより、任意の範囲で第1のポート番号の割当てを実現するという作用をもたらす。
【0030】
【発明の実施の形態】
次に本発明の実施の形態について図面を参照して詳細に説明する。
【0031】
図1を参照すると、本発明の実施の形態におけるアドレス変換装置100は、信号線201を介して構内ネットワーク200に接続し、信号線301を介して広域ネットワーク300に接続する。構内ネットワーク200には、サーバ210および端末290が接続される。また、広域ネットワーク300には端末390が接続される。
【0032】
例えば広域ネットワーク300をインターネットとすると、広域ネットワーク300上のコンピュータ(例えば、端末390)は、グローバルIPアドレスにより特定される。一方、構内ネットワーク上のコンピュータ(例えば、サーバ210および端末290)には、ローカルIPアドレス(プライベートIPアドレスともいう。)が与えられる。
【0033】
インターネットで使用されるTCP/IPプロトコルでは、ネットワーク層でIPプロトコルを用いてIPアドレスによるコンピュータの特定を行う他、トランスポート層ではTCPプロトコルまたはUDPプロトコルを用いてポート番号によるアプリケーションの特定を行う。このポートはTCPプロトコルおよびUDPプロトコルのそれぞれに16ビット分割当てられており、それぞれ0から65535の範囲でポート番号を割当てることができる。したがって、コンピュータ間の通信においては、送信元IPアドレス、送信先IPアドレス、送信元ポート番号、送信先ポート番号、および、プロトコル(TCPまたはUDP)、の5つにより送信元と送信先が特定されることになる。
【0034】
例えば、サーバ210のローカルIPアドレスが192.168.0.3であってWWW(World-Wide-Web)サーバとしてのローカルポート番号がTCP8080の場合、ローカルIPアドレスが192.168.0.15の端末290からローカルポート番号1234でアクセスするときには、「送信元IPアドレス=192.168.0.15、送信先IPアドレス=192.168.0.3、送信元ポート番号=1234、送信先ポート番号=8080、プロトコル=TCP」を含むパケットが端末290からサーバ210に送られる。
【0035】
一方、例えば、サーバ210のグローバルIPアドレスが202.238.95.65であってWWWサーバとしてのグローバルポート番号がTCP80の場合、グローバルIPアドレスが216.234.188.75の端末390からローカルポート番号1963でアクセスするときには、「送信元IPアドレス=216.234.188.75、送信先IPアドレス=202.238.95.65、送信元ポート番号=1963、送信先ポート番号=80、プロトコル=TCP」を含むパケットが端末390からアドレス変換装置100に送られる。そして、アドレス変換装置100においてアドレス変換が行われ、「送信元IPアドレス=216.234.188.75、送信先IPアドレス=192.168.0.3、送信元ポート番号=1963、送信先ポート番号=8080、プロトコル=TCP」を含むパケットがアドレス変換装置100からサーバ210に送られる。
【0036】
図2を参照すると、アドレス変換装置100は、パケットの受け渡しを行う通信部110と、パケットの解析を行うパケット解析部120と、アドレス変換テーブル130と、ポート状態テーブル140とポート割当て処理部150とを備えている。通信部110は、信号線301を介して広域ネットワーク300からパケットを受け取り、グローバルアドレス(グローバルIPアドレスおよびグローバルポート番号)からローカルアドレス(ローカルIPアドレスおよびローカルポート番号)へのアドレス変換を行って構内ネットワーク200へのパケットを信号線201に出力する。また、通信部110は、信号線201を介して構内ネットワーク200からパケットを受け取り、ローカルアドレスからグローバルアドレスへのアドレス変換を行って広域ネットワーク300へのパケットを信号線301に出力する。
【0037】
パケット解析部120は、構内ネットワーク200のパケットを信号線112を介して通信部110から受け取り、TCPプロトコルやUDPプロトコルよりも高位のプロトコルにより交換されるデータ領域を主に解析する。すなわち、TCP/IPプロトコルにおいて交換されるパケットは、IPヘッダ、TCPまたはUDPヘッダ、および、データ領域から構成されるが、パケット解析部120はこのデータ領域を主に解析する。より具体的には、データ領域において、サーバ210のローカルポート番号が示されている場合、その表示位置を特定して通信部110に知らせる。通信部110はこれを受けてローカルポート番号をグローバルポート番号に差し替える。
【0038】
ポート割当て処理部150は、制御部151と、ポート定義ファイル152と、設定ポート検索部153と、使用中ポート検索部154とを備える。制御部151は、信号線115を介して通信部110からポート割当て要求を受け、グローバルポート番号の取得を行う。ポート定義ファイル152は、グローバルポート番号の割当てを行う際の割当て対象となるポート番号の最大値および最小値を保持する。設定ポート検索部153は、アドレス変換テーブル130を参照して、アドレス変換テーブル130に既に設定されているポート番号を検索する。使用中ポート検索部154は、ポート状態テーブル140を参照して、ポート状態テーブル140において既に使用されているポート番号を検索する。
【0039】
図3を参照すると、アドレス変換テーブル130は、グローバルIPアドレス131と、グローバルポート番号132と、ローカルIPアドレス133と、ローカルポート番号134と、プロトコル135との対応関係を保持する。例えば、第1番目のエントリでは、グローバルIPアドレス「202.238.95.65」のTCPポート番号「80」が、ローカルIPアドレス「192.168.0.3」のTCPポート番号「8080」に対応することがわかる。
【0040】
通信部110は、このアドレス変換テーブル130に基づいて、グローバルアドレスからローカルアドレスへのアドレス変換およびローカルアドレスからグローバルアドレスへのアドレス変換を行う。また、設定ポート検索部153は、このアドレス変換テーブル130を参照することにより、既に設定済みのポート番号を検索する。
【0041】
図4を参照すると、ポート状態テーブル140は、アドレス変換装置100のグローバルポート番号141と、プロトコル142と、ポートの状態143と、接続先のグローバルアドレス144とを保持する。このポート状態テーブル140によって管理されるポートは全てアドレス変換装置100のポートであるため、IPアドレスは省略されている。
【0042】
例えば、第1番目のエントリでは、アドレス変換装置100のTCPポート番号「22」が広域ネットワーク300に対して接続待ち状態(LISTEN)となっていることがわかる。また、第2番目のエントリでは、アドレス変換装置100のTCPポート番号「80」に対してグローバルIPアドレス「216.234.188.75」のTCPポート番号「1963」が接続中(ESTABLISHED)であることがわかる。
【0043】
使用中ポート検索部154は、このポート状態テーブル140を参照することにより、接続待ちポートまたは接続中ポートとして既に使用されているポート番号を検索する。
【0044】
次に本発明の実施の形態における一動作例について説明する。
【0045】
図5を参照すると、まず、広域ネットワーク300上の端末390はサーバ210に対するポート割当て要求3901を含むパケットを出力する。このポート割当て要求3901としては、例えば、HTTP(HyperText Transfer Protocol)からCGI(Common Gateway Interface)を用いて、ポート取得を行うプログラムを起動することが考えられる。また、インターネット放送などのストリーミングを行うRTSPでは、予めストリーミング用のポートを確保しておく必要があり、ストリーミングを開始する前にクライアントからサーバに対してポート割当て要求としてSETUPコマンドが発行される。また、インターネット電話などに使用されるSIPでは、予め発呼側と着信側との間の呼設定をしておく必要があり、事前にクライアントからサーバに対して呼設定要求としてINVITEコマンドが発行される。なお、このポート割当て要求3901を受けるサーバのグローバルIPアドレスおよびグローバルポート番号は、事前に利用者に知らされているものとする。
【0046】
ポート割当て要求3901を受けたアドレス変換装置100は、アドレス変換テーブル140を参照してパケットのアドレス変換101を行う。すなわち、IPヘッダにおける送信先IPアドレスをグローバルIPアドレスからローカルIPアドレスに変換するとともに、TCPヘッダにおける送信先ポート番号をグローバルポート番号からローカルポート番号に変換する。アドレス変換装置100は、このようにしてアドレス変換されたパケットをポート割当て要求1001としてサーバ210に出力する。
【0047】
ポート割当て要求1001を受けたサーバ210は、ローカルポート番号の取得処理211を行い、その結果をリプライ2101としてアドレス変換装置100に出力する。ここでは、上述のように、例えばHTTPではCGIによりポート取得のためのプログラムが実行され、RTSPではSETUPコマンドが実行され、また、SIPではINVITEコマンドが実行される。
【0048】
次にアドレス変換装置100は、グローバルポート番号の取得処理102を行う。この処理内容については後述する。アドレス変換装置100は、このグローバルポート番号の取得処理102により取得されたグローバルポート番号とローカルポート番号の取得処理211により取得されたローカルポート番号との対応関係をアドレス変換テーブル140に設定する(103)。この設定により、グローバルポート番号およびローカルポート番号が正式に割り当てられたことになる。
【0049】
アドレス変換装置100は、このようにして得られたグローバルポート番号とローカルポート番号との対応関係に基づいて、パケットのデータ領域におけるローカルポート番号をグローバルポート番号に差し替える(104)。アドレス変換装置100は、さらにアドレス変換テーブル140を参照してパケットのアドレス変換105を行う。すなわち、IPヘッダにおける送信元IPアドレスをローカルIPアドレスからグローバルIPアドレスに変換するとともに、TCPヘッダにおける送信元ポート番号をローカルポート番号からグローバルポート番号に変換する。アドレス変換装置100は、このようにしてアドレス変換されたパケットをリプライ1002として端末390に出力する。
【0050】
端末390はリプライ1002に含まれるポート番号を用いてサーバ210に対するサービスの要求3902を含むパケットを出力する。このサービスの要求3902としては、例えば、RTSPではストリーミングの開始のためにPLAYコマンドが発行される。また、SIPでは呼設定の確認応答のためにACKコマンドが発行される。
【0051】
サービス要求3902を受けたアドレス変換装置100は、アドレス変換テーブル140を参照してパケットのアドレス変換106を行う。すなわち、IPヘッダにおける送信先IPアドレスをグローバルIPアドレスからローカルIPアドレスに変換するとともに、TCPヘッダにおける送信先ポート番号をグローバルポート番号からローカルポート番号に変換する。アドレス変換装置100は、このようにしてアドレス変換されたパケットをサービス要求1003としてサーバ210に出力する。
【0052】
サービス要求1003を受けたサーバ210は、要求されたサービスに応じたデータ2102を送信する。例えば、RTSPではストリーミングデータとして音声データや画像データなどが送信される。また、SIPでは通話データとして音声データなどが送信される。
【0053】
データ2102を含むパケットを受け取ったアドレス変換装置100は、アドレス変換テーブル140を参照してパケットのアドレス変換107を行う。すなわち、IPヘッダにおける送信元IPアドレスをローカルIPアドレスからグローバルIPアドレスに変換するとともに、TCPヘッダにおける送信元ポート番号をローカルポート番号からグローバルポート番号に変換する。アドレス変換装置100は、このようにしてアドレス変換されたパケットをデータ1004として端末390に出力する。
【0054】
次に図5におけるグローバルポート番号の取得処理102の一動作例について説明する。
【0055】
ポート割当て要求には、割り当てるポートの数(Num)、開始ポート番号(Pstart)の指定、ならびに、連続番号に限る旨の指定を含めることができるものとする。すなわち、開始ポート番号の指定がされている場合には、指定された開始ポート番号から要求された数のポートを取得できなければポート取得に失敗したことになる。また、連続番号に限る旨の指定がされている場合には、要求された数のポートを連続番号により取得できなければポート取得に失敗したことになる。
【0056】
なお、この取得処理102では、ポート番号を仮に「取得」するものであり、このようにして取得されたポート番号は、アドレス変換テーブル130への設定103が行われることにより正式に「割り当て」られる。
【0057】
図6を参照すると、まずポート割当て要求において開始ポート番号の指定がされているか否かを判断する(ステップS901)。開始ポート番号の指定がされていなければポート初期値を発生する(ステップS911)。このポート初期値の発生にはセキュリティの都合上、乱数を用いることがより好ましい。
【0058】
一方、開始ポート番号の指定がされていればその開始ポート番号からポート取得を試みるが、それに先立ってその開始ポート番号が取得対象の範囲内であるか否かを判断する(ステップS902)。すなわち、ポート定義ファイル152(図2)に保持された最小値をPmin、最大値をPmaxとすると、
Pmin≦Pstart≦Pmax−Num+1
を満たしていれば取得対象の範囲内とする。もし、開始ポート番号が取得対象の範囲外である場合には、指定値に誤りがあるとしてその旨が返信される(ステップS940)。
【0059】
指定された開始ポート番号が取得対象の範囲内であれば(ステップS902)、設定ポート検索部153および使用中ポート検索部154(図2)によりそれぞれアドレス変換テーブル130およびポート状態テーブル140を検索して取得可能なポート番号を調べる(ステップS903)。その結果、指定された開始ポート番号からポート数Num個分のポート番号を連続して取得することが可能であれば(ステップS904)、ポート番号取得は成功する(ステップS920)。一方、連続して取得することが不可能であれば(ステップS904)、連続番号に限る旨の指定がされているか否かを調べ(ステップS905)、連続番号に限る旨の指定がされていなければ非連続番号によるポート番号取得の可能性を調べる(ステップS906)。その結果、非連続番号によるポート番号取得が可能であれば(ステップS906)、ポート番号取得は成功する(ステップS920)。これに対し、連続して取得することが不可能で且つ連続番号に限る旨の指定がされている場合(ステップS905)ならびに非連続番号によるポート番号取得が不可能な場合(ステップS906)には、ポート番号取得は失敗したものとしてその旨が返信される(ステップS930)。
【0060】
一方、開始ポート番号の指定がされずにポート初期値を発生した場合(ステップS911)、そのポート初期値を開始ポート番号Pstartとして、設定ポート検索部153および使用中ポート検索部154(図2)によりそれぞれアドレス変換テーブル130およびポート状態テーブル140を検索して取得可能なポート番号を調べる(ステップS912)。その結果、発生したポート初期値から最大値Pmaxの間でポート数Num個分のポート番号を連続して取得することが可能であれば(ステップS913)、ポート番号取得は成功する(ステップS920)。発生したポート初期値Pstartからのポート番号取得が不可能であれば、最小値Pminから「Pstart+Num−2」までの間でポート数Num個分のポート番号を連続して取得することが可能であれば(ステップS913)、ポート番号取得は成功する(ステップS920)。一方、何れによっても連続してポート番号取得することが不可能であれば(ステップS913、S914)、連続番号に限る旨の指定がされているか否かを調べ(ステップS915)、連続番号に限る旨の指定がされていなければ非連続番号によるポート番号取得の可能性を調べる(ステップS916)。その結果、非連続番号によるポート番号取得が可能であれば(ステップS916)、ポート番号取得は成功する(ステップS920)。これに対し、連続して割当てることが不可能で且つ連続番号に限る旨の指定がされている場合(ステップS915)ならびに非連続番号によるポート番号取得が不可能な場合(ステップS916)には、ポート番号取得は失敗したものとしてその旨が返信される(ステップS930)。
【0061】
次に本発明の実施の形態における処理の具体例について説明する。
【0062】
図7を参照すると、ポート割当て要求3901(図5)のパケット3900の一例は、IPヘッダ3910と、TCPヘッダ3920と、データ領域3930とを備える。IPヘッダ3910は、送信元IPアドレス3911と、送信先IPアドレス3912とを含む。また、IPヘッダ3910は、(図示しない)プロトコル指定を含む。図7の例ではTCPプロトコルが指定されたものとしているが、これはUDPプロトコルであってもよい。UDPプロトコルが指定された場合にはIPヘッダ3910の次にはUDPヘッダが存在することになる。TCPヘッダ3920は、送信元ポート番号3921と、送信先ポート番号3922とを含む。UDPヘッダの場合もTCPヘッダと同様に送信元ポート番号および送信先ポート番号が含まれる。
【0063】
これにより、端末390からサーバ210に対するパケットでは、端末390のグローバルIPアドレスおよびグローバルポート番号がそれぞれ送信元IPアドレス3911および送信元ポート番号3921に格納され、サーバ210のグローバルIPアドレスおよびグローバルポート番号がそれぞれ送信先IPアドレス3912および送信先ポート番号3922に格納される。そして、アドレス変換装置100において、送信先IPアドレス3912および送信先ポート番号3922の部分がサーバ210のローカルIPアドレスおよびローカルポート番号に置き換えられてサーバ210に送信される。
【0064】
また、データ領域3930は、ポート要求割当てコマンド3931を含む。このポート要求割当てコマンド3931は、アプリケーション層において指示されるものであり、アプリケーション層のプロトコルに依存する。
【0065】
図8を参照すると、リプライ2101(図5)のパケット2100の一例は、IPヘッダ2110と、TCPヘッダ2120と、データ領域2130とを備える。IPヘッダ2110は、図7のパケット3900と同様に、送信元IPアドレス2111と、送信先IPアドレス2112とを含み、さらに(図示しない)プロトコル指定を含む。また、TCPヘッダ2120は、図7のパケット3900と同様に、送信元ポート番号2121と、送信先ポート番号2122とを含む。
【0066】
これにより、サーバ210から端末390に対するパケットでは、サーバ210のローカルIPアドレスおよびローカルポート番号がそれぞれ送信元IPアドレス2111および送信元ポート番号2121に格納され、端末390のグローバルIPアドレスおよびグローバルポート番号がそれぞれ送信先IPアドレス2112および送信先ポート番号2122に格納される。そして、アドレス変換装置100において、送信元IPアドレス2112および送信元ポート番号2122の部分がサーバ210のグローバルIPアドレスおよびグローバルポート番号に置き換えられて端末390に送信される。
【0067】
また、データ領域2130は、サーバポート番号2132を含む。このサーバポート番号2132は、アプリケーション層において交換されるものであり、アプリケーション層のプロトコルに依存する。サーバ210から端末390に対するパケットでは、サーバポート番号2132にサーバ210のローカルポート番号が格納されているが、アドレス変換装置100において、サーバ210のグローバルポート番号に差し替えられて端末390に送信される。
【0068】
図9および図10はHTTPによる一具体例である。HTTPの場合、図7のポート割当て要求コマンド3931として、図9の第1行目のようにGETコマンドを用いることができる。この場合、ポート割当てを実現するプログラムがサーバ210に保持されており、CGIにより実行される。そのプログラムの実行ファイルを指定しているのが第2行目の「実行ファイル」である。また、このプログラムのパラメータが第3行目に示されている。ここでは、パラメータとして、割り当てるポートの個数、開始ポート番号、連続番号に限る旨の指定が可能となっており、図9の例ではそれぞれ、ポートの個数が「3」、開始ポート番号の指定は「なし」、連続番号に「限る」旨の指定がされている。これらパラメータで指定される項目は、そのポートを利用するアプリケーションに依存するものであり、この時点で適正なポートを割り当てておく必要がある。
【0069】
このようにしてHTTPによるポート割当て要求コマンドを実行すると、図10のデータ領域2134に示されるような応答が得られる。第1行目は処理が正常に終了したことを示すステータス行であり、第2行目は続くボディ部のデータがHTML(HyperText Mark-up Language)形式であることを表すものである。第3行目の空白行に続く第4行目以降がHTML形式で記述されたデータである。この例では、3000から3002の連続する3つのポート番号がローカルポート番号として割り当てられている。
【0070】
アドレス変換装置100は、データ領域2134を含むパケットを受けると、データ領域2134を解析して、ポート番号を表示している位置を明らかにする。そして、図6のフローによって割り当てられたグローバルポート番号を、パケット内のポート番号の表示位置に埋め込むことにより、図10のデータ領域2135を得る。すなわち、ローカルポート番号3000乃至3002が、グローバルポート番号5000乃至5002に差し替えられる。
【0071】
この様子を表したのが図11である。図11を参照すると、ローカルIPアドレス「192.168.0.3」のサーバ210はHTTP用ポート番号として「8080」を用意しており、これらはアドレス変換装置100によりグローバルIPアドレス「202.238.95.65」のポート番号「80」に変換されて公開されているものとする。そして、このグローバルIPアドレス「202.238.95.65」のポート番号「80」にポート割当て要求があると、サーバ210はローカルポート番号として3つのポート番号「3000乃至3002」を割り当てる。また、アドレス変換装置100はグローバルポート番号として3つのポート番号「5000乃至5002」を割り当てる。これらの対応関係をアドレス変換装置100がアドレス変換装置130(図2)に設定することにより、それ以降グローバルIPアドレス「202.238.95.65」のポート番号「5000乃至5002」がサービス提供に使用されるようになる。
【0072】
図12および図13はRTSPによる一具体例である。RTSPの場合、図7のポート割当て要求コマンド3931として、図12の第1行目のようにSETUPコマンドを用いることができる。このSETUPコマンドはセッションの初期化を行うコマンドであり、第2行目に示されるストリームサーバに対して伝送方法の設定を指示する。このとき、第3行目のようにクライアント側の接続先ポート番号が指定される。この例では、クライアント側のポート番号として4000乃至4001の連続する2つのポート番号が指定されている。したがって、サーバ側のポート番号としても連続する2つのポート番号を割り当てなければならない。
【0073】
このようにしてRTSPによるポート割当て要求コマンドを実行すると、図13のデータ領域2136に示されるような応答が得られる。第1行目は処理が正常に終了したことを示すステータス行であり、第2および3行目はそれぞれRTSPによるメッセージの連続番号および一連の通信に与えられるセッション番号である。第4行目以降のトランスポートパラメータにおいてポートの属性が定義されており、この例では、クライアント側のポート番号4000乃至4001に対して、サーバ側のローカルポート番号としてポート番号3000乃至3001が割り当てられている。
【0074】
アドレス変換装置100は、データ領域2136を含むパケットを受けると、データ領域2136を解析して、ポート番号を表示している位置を明らかにする。そして、図6のフローによって割り当てられたグローバルポート番号を、パケット内のポート番号の表示位置に埋め込むことにより、図13のデータ領域2137を得る。すなわち、サーバ側のローカルポート番号3000乃至3001が、グローバルポート番号6000乃至6001に差し替えられる。
【0075】
図14および図15はSIPによる一具体例である。SIPの場合、図7のポート割当て要求コマンド3931として、図14の第1行目のようにINVITEコマンドを用いることができる。このINVITEコマンドは呼設定を行うコマンドであり、第2行目に示される着信側(例えば、端末290)に対して、第3行目に示されるサーバを経由して通話するよう設定を指示する。このとき、第4行目のようにメディア属性として発呼側の送信者情報が記述される。このような記述はSDP(Session Description Protocol)として知られている。この例では、音声用のポート番号として2000が指定されている。したがって、着信側としても音声用のポート番号を1つ割り当てる必要がある。
【0076】
このようにしてSIPによるポート割当て要求コマンドを実行すると、図15のデータ領域2138に示されるような応答が得られる。第1行目は処理が正常に終了したことを示すステータス行であり、第2行目から4行目にかけてはサーバおよび発呼側と着信側の情報が記述されている。最終行が着信側の情報を表すメディア属性である。この例では、着信側のローカルポート番号としてポート番号3000が割り当てられている。
【0077】
アドレス変換装置100は、データ領域2138を含むパケットを受けると、データ領域2138を解析して、ポート番号を表示している位置を明らかにする。そして、図6のフローによって割り当てられたグローバルポート番号を、パケット内のポート番号の表示位置に埋め込むことにより、図15のデータ領域2139を得る。すなわち、着信側のローカルポート番号3000が、グローバルポート番号7000に差し替えられる。
【0078】
このように、本発明の実施の形態によれば、アプリケーション層で交換されるパケット2100のデータ領域2130におけるローカルポート番号2132をアドレス変換装置100がグローバルポート番号に差し替えることにより、アプリケーション層におけるポート番号の変換を行うことができる。
【0079】
また、この実施の形態によれば、ポート割当てのパラメータとして、割り当てるポートの個数、開始ポート番号、連続番号に限る旨の指定ができ、アプリケーションの仕様に合わせたポート割当てを実現できる。
【0080】
次に本発明の実施の形態の第1の変形例について説明する。
【0081】
図16を参照すると、この第1の変形例では、アドレス変換装置100におけるグローバルポート番号の取得処理102は、サーバ210におけるローカルポート番号の取得処理211の結果を待たずに実行される。図2のパケット解析部120は、端末390からのポート割当て要求3901を含むパケットを解析し、割り当てるべきポート番号の条件を抽出する。そして、その条件に合致するグローバルポート番号を取得する。サーバ210におけるローカルポート番号の取得処理211は、アドレス変換装置100におけるグローバルポート番号の取得処理102と並行して行われる。したがって、図16の第1の変形例によれば、図5の例のようにサーバ210におけるローカルポート番号の取得処理211とアドレス変換装置100におけるグローバルポート番号の取得処理102とを逐次的に行うよりも高速に処理することができる。
【0082】
次に本発明の実施の形態の第2の変形例について説明する。
【0083】
図17を参照すると、本発明の実施の形態の第2の変形例におけるアドレス変換装置100は、図2の構成例に加えて、サーバ代理部160と、プロキシ記憶部170とをさらに備えている。サーバ代理部160は、サーバ210の代理サーバ(プロキシサーバ)として機能するものであり、サーバ210に代わってサービスを提供する。プロキシ記憶部170は、サーバ210の記憶領域(例えば、ディスク領域)のコピーを保持するものである。サーバ210に対するサービス要求が通信部110から信号線116を介してされると、サーバ代理部160は、修正時刻が古くないことを条件としてプロキシ記憶部170の内容を用いてサービスの提供を行う。
【0084】
図18を参照すると、この第2の変形例におけるアドレス変換装置100は、プロキシ記憶部170を参照し、サーバ210に代わってローカルポート番号の取得処理109を行う。この取得結果はアドレス変換装置100からサーバ210に報告される(1009)。この報告はグローバルポート番号の取得処理102と並行して実行できるため、この第2の変形例によれば、アドレス変換装置100とサーバ210の間の通信時間を隠蔽することが可能となる。
【0085】
なお、本発明の実施の形態では、HTTPプロトコル、RTSPプロトコルおよびSIPプロトコルを例として説明したが、これらはトランスポート層より高位のプロトコルの一例であり、本発明はこれらに限られず、トランスポート層より高位のプロトコルについて広く適用される。
【0086】
【発明の効果】
以上の説明で明らかなように、本発明によると、構内ネットワーク上のサーバへのポート割当て要求に対してグローバルポート番号を動的に取得して割り当てるという効果が得られる。
【図面の簡単な説明】
【図1】本発明によるアドレス変換装置を用いたシステム構成を示す図である。
【図2】本発明によるアドレス変換装置の実施の形態の構成を示すブロック図である。
【図3】本発明におけるアドレス変換テーブルの構成例を示す図である。
【図4】本発明におけるポート状態テーブルの構成例を示す図である。
【図5】本発明によるアドレス変換装置の実施の形態の動作例を示すシーケンス図である。
【図6】本発明におけるグローバルポート番号割当て処理手順を示すフローチャートである。
【図7】本発明におけるポート割当て要求コマンドを含むパケットの構成例を示す図である。
【図8】本発明における割当てポート番号を含むパケットの構成例を示す図である。
【図9】本発明におけるHTTPによるポート割当て要求コマンドの構成例を示す図である。
【図10】本発明におけるHTTPによるポート番号割当て結果報告の構成例を示す図である。
【図11】本発明におけるHTTPによるポート番号割当て結果の対応例を示す図である。
【図12】本発明におけるRTSPによるポート割当て要求コマンドの構成例を示す図である。
【図13】本発明におけるRTSPによるポート番号割当て結果報告の構成例を示す図である。
【図14】本発明におけるSIPによるポート割当て要求コマンドの構成例を示す図である。
【図15】本発明におけるSIPによるポート番号割当て結果報告の構成例を示す図である。
【図16】本発明によるアドレス変換装置の実施の形態の第1の変形例における動作例を示すシーケンス図である。
【図17】本発明によるアドレス変換装置の実施の形態の第2の変形例の構成を示すブロック図である。
【図18】本発明によるアドレス変換装置の実施の形態の第2の変形例における動作例を示すシーケンス図である。
【符号の説明】
100 アドレス変換装置
110 通信部
120 パケット解析部
130 アドレス変換テーブル
131 グローバルIPアドレス
132 グローバルポート番号
133 ローカルIPアドレス
134 ローカルポート番号
135 プロトコル
140 ポート状態テーブル
141 ポート番号
142 プロトコル
143 ポート状態
144 接続先
150 ポート割当て処理部
151 制御部
152 ポート定義ファイル
153 設定ポート検索部
154 使用中ポート検索部
160 サーバ代理部
170 プロキシ記憶部
200 構内ネットワーク
210 サーバ
290 端末
300 広域ネットワーク
390 端末
2100、3900 パケット
2110、3910 IPヘッダ
2120、3920 TCPヘッダ
2130、3930 データ領域
2111、3911 送信元IPアドレス
2112、3912 送信先IPアドレス
2121、3921 送信元ポート番号
2122、3922 送信先ポート番号
2132 ポート番号
3931 ポート割当て要求コマンドBACKGROUND OF THE INVENTION
The present invention relates to an address translation apparatus for connecting a wide area network and a private network, a port number replacement method and a port number assignment method in the address translation apparatus.
[0001]
[Prior art]
In a protocol called TCP / IP (Transmission Control Protocol / Internet Protocol) used for Internet connection or the like, an IP (Internet Protocol) protocol is used in a network layer, and a TCP (Transmission Control Protocol) protocol or UDP (UDP) is used in a transport layer. User Datagram Protocol) is used. In the IP protocol, a 32-bit address (in the case of IPv4) called an IP address is used when data is exchanged between computers. Further, in the TCP protocol and the UDP protocol, data entry / exit called a port is determined in order to distinguish data for each application.
[0002]
An address conversion device that connects a wide area network (WAN: wide area network, for example, the Internet) and a local area network (LAN: local area network) mutually converts an address in the wide area network and an address in the local area network. As described above, in the TCP / IP protocol, an IP address and a port number are used to identify a computer and an application on a network. Therefore, many address conversion apparatuses adopt a function for converting these IP addresses and port numbers. is doing. This IP address and port number conversion function is called NAPT (Network Address Port Translation), ENAT (Enhanced Network Address Translation), or IP masquerade. On the other hand, the function of converting only an IP address is called NAT (Network Address Translation) or the like. The address translation in the present application means broad address translation including NAT and NAPT.
[0003]
When connecting a server on a local network to a wide area network via an address translator, a wide area IP address (hereinafter referred to as a global IP address) and a wide area port number (hereinafter referred to as a global port number) for accessing the server from the wide area network. It is necessary to inform them. The address translation device receives a packet from a terminal (client) on the wide area network to the server, and uses the global IP address and global port number of the destination as the local IP address (hereinafter referred to as local IP address) and local port of the server. Each is converted into a number (hereinafter referred to as a local port number). Also, the address translation device translates the local IP address and local port number of the transmission source into the global IP address and global port number for the packet from the server to the terminal on the wide area network.
[0004]
[Problems to be solved by the invention]
In the above-described conventional technology, it is assumed that a global IP address and a global port number for accessing a server from a wide area network are fixed. However, there are also protocols that dynamically generate port numbers for communication. For example, in the RTSP (Real Time Streaming Protocol) protocol used for Internet broadcasting, a port number for streaming is once generated by accessing a server, and then streaming is performed using the port number. . In this case, since the port number generated on the premises is exchanged in the RTSP protocol of the application layer, the local port number itself is notified to the wide area network without being converted by the conventional address translation device. Normally, since the local port number and the global port number are different, access is not permitted even if the local port number is used from the wide area network side. If the local port number and the global port number are the same without converting the port number, the port number may be duplicated among a plurality of servers connected to the local network.
[0005]
An object of the present invention is to dynamically acquire and assign a global port number in response to a port assignment request to a server on a local network.
[0006]
[Means for Solving the Problems]
In order to solve the above problems, an address translation apparatus according to the present invention is an address translation apparatus that connects a first network (for example, a wide area network) and a second network (for example, a private network), and includes a transport layer. The second port number (eg, local port number) of the second network exchanged in a higher protocol is replaced with the first port number (eg, wide area port number) of the first network. As a result, the first port number is dynamically assigned in response to the port assignment request to the server on the second network.
[0007]
In addition, another address translation apparatus of the present invention acquires and assigns the first port number in response to a port assignment request in the protocol. As a result, the first port number dynamically generated in the address translation device is assigned.
[0008]
Another address translation device of the present invention is an address translation device for connecting a first network and a second network, and is a second one of the second network exchanged in a protocol higher than the transport layer. Packet analysis means for extracting the port number of 2 from the packet of the second network, and generating the packet to the first network by replacing the second port number with the first port number of the first network Communication means. As a result, the second port number exchanged in the protocol higher than the transport layer is replaced with the first port number and notified to the first network.
[0009]
In another address translation apparatus of the present invention, the protocol is a higher-order protocol than the TCP protocol. In other words, the second port number exchanged in the protocol higher than the TCP protocol is replaced with the first port number and notified to the first network.
[0010]
In another address translation apparatus of the present invention, the protocol is a higher-order protocol than the UDP protocol. In other words, the second port number exchanged in the protocol higher than the UDP protocol is replaced with the first port number and notified to the first network.
[0011]
In another address translation apparatus of the present invention, the protocol is an application layer protocol. In other words, the second port number exchanged in the application layer protocol is replaced with the first port number and notified to the first network.
[0012]
In another address translation apparatus of the present invention, the protocol is an HTTP protocol. In other words, the second port number exchanged in the HTTP protocol is replaced with the first port number and notified to the first network.
[0013]
In another address translation device of the present invention, the protocol is an RTSP protocol. In other words, the second port number exchanged in the RTSP protocol is replaced with the first port number and notified to the first network.
[0014]
In another address translation device of the present invention, the protocol is a SIP protocol. In other words, the second port number exchanged in the SIP protocol is replaced with the first port number and notified to the first network.
[0015]
In addition, another address translation apparatus of the present invention further comprises a port assignment processing means for obtaining and assigning the first port number in response to a port assignment request from the first network. As a result, the first port number dynamically generated in the address translation device is assigned.
[0016]
In another address translation apparatus of the present invention, the port assignment processing means is set by a set port search means for searching for a first port number already set in the address conversion table, and the set port search means. Control means for obtaining a first port number according to the number of ports in the allocation request from among the first port numbers confirmed not to be present. As a result, it is possible to avoid assigning the set first port number.
[0017]
According to another address translation apparatus of the present invention, the port assignment processing means is already used in the port status table and the set port search means for searching for the first port number already set in the address translation table. In-use port search means for searching for a first port number that is in use and a first port that has been confirmed not to be set by the set port search means and not used by the in-use port search means Control means for acquiring a first port number from the port numbers according to the number of ports in the allocation request. As a result, it is possible to avoid assigning the first port number that is already set or in use.
[0018]
In another address translation device of the present invention, the allocation request includes whether or not a start number of the first port number to be allocated is specified, and the control means initializes a port initial value when the start number is not specified. A value is generated by a random number, and the first port number is acquired using this port initial value as a start number. Thereby, the regularity is removed from the port initial value, and the security level is improved.
[0019]
Also, in another address translation device of the present invention, the allocation request includes designation of a start number of a first port number to be allocated, and the control means performs the first port number from the start number included in the allocation request. To get. As a result, the port number according to the application specification is assigned.
[0020]
Further, in another address translation device of the present invention, the port assignment processing means further comprises a port definition file that holds a minimum value and a maximum value of the first port number to be acquired, and the control means The first port number is acquired in the range from the minimum value to the maximum value in the port definition file. This brings about the effect | action of implement | achieving allocation of a 1st port number in arbitrary ranges.
[0021]
Further, in another address translation device of the present invention, the allocation request includes designation of a start number of the first port number to be allocated, and the control means determines that the start number included in the allocation request is from the minimum value to the minimum value. It is determined whether it is within the range of the maximum value, and if it is within the range of the maximum value from the minimum value, the first port number is acquired from the start number, and the range from the minimum value to the maximum value must be obtained. If this is the case, a start number specification error is notified. As a result, the start number of the designated first port number is kept appropriate.
[0022]
In another address translation device of the present invention, the allocation request includes designation of whether or not the first port number to be allocated is limited to a serial number, and the control means limits the allocation request to the serial number. If the serial number cannot be acquired as the first port number, the acquisition fails. If the allocation request does not include the specification indicating that the serial number is limited, the serial number cannot be acquired. Get non-sequential numbers. This brings about the effect | action that the 1st port number according to the specification of an application is allocated.
[0023]
Further, another address translation apparatus of the present invention includes a proxy storage unit that holds a copy of a storage area of a server connected to the second network, and the number of ports in the allocation request with reference to the proxy storage unit And a server proxy means for acquiring a second port number and generating a packet of the second network. As a result, the address translation device itself assigns the second port number.
[0024]
Further, the port number replacement method of the present invention includes a procedure for extracting the second port number of the second network exchanged in a protocol higher than the transport layer from the packet of the second network; Generating a packet to the first network by replacing the port number with the first port number of the first network. As a result, the second port number exchanged in the protocol higher than the transport layer is replaced with the first port number and notified to the first network.
[0025]
According to another port number replacement method of the present invention, a procedure for extracting a second port number of a second network exchanged in a protocol higher than a transport layer from a packet of the second network, A procedure for acquiring and assigning a first port number of the first network, and a procedure for generating a packet to the first network by replacing the second port number with the first port number. As a result, the first port number dynamically generated in the address translation device is notified.
[0026]
Further, the port number assignment method of the present invention includes a procedure for receiving a port assignment request from the first network, a procedure for searching for the first port number already set in the address conversion table, and already in the address conversion table. A procedure for acquiring and assigning a first port number according to the number of ports in the assignment request from among the unset first port numbers. As a result, it is possible to avoid assigning the set first port number.
[0027]
Further, another port number assignment method of the present invention includes a procedure for receiving a port assignment request from the first network, a procedure for searching for a first port number already set in the address translation table, and a port status table. A procedure for searching for a first port number that is already used, and a port in the allocation request from among the first port numbers that are not already set in the address conversion table and are not already used in the port status table Obtaining and assigning a first port number according to the number. As a result, it is possible to avoid assigning the first port number that is already set or in use.
[0028]
In addition, another port number assignment method of the present invention includes a procedure for receiving a port assignment request from the first network, a procedure for generating a port initial value by a random number, and a first port already set in the address translation table. A procedure for retrieving a number, a procedure for retrieving a first port number that is already used in the port status table, and a first that is not already set in the address translation table and is not already used in the port status table And acquiring and assigning a first port number using the initial port value as a start number in accordance with the number of ports in the assignment request. Thereby, the regularity is removed from the port initial value, and the security level is improved.
[0029]
In another port number allocation method of the present invention, the procedure for acquiring the first port number is performed within a range from the minimum value to the maximum value of the first port number to be acquired held in the port definition file. The first port number is acquired. This brings about the effect | action of implement | achieving allocation of a 1st port number in arbitrary ranges.
[0030]
DETAILED DESCRIPTION OF THE INVENTION
Next, embodiments of the present invention will be described in detail with reference to the drawings.
[0031]
Referring to FIG. 1, the
[0032]
For example, when the
[0033]
In the TCP / IP protocol used on the Internet, a computer is specified by an IP address using the IP protocol in the network layer, and an application is specified by a port number using the TCP protocol or the UDP protocol in the transport layer. This port is assigned 16 bits to each of the TCP protocol and the UDP protocol, and a port number can be assigned in the range of 0 to 65535, respectively. Therefore, in communication between computers, a transmission source and a transmission destination are specified by five of a transmission source IP address, a transmission destination IP address, a transmission source port number, a transmission destination port number, and a protocol (TCP or UDP). Will be.
[0034]
For example, when the local IP address of the
[0035]
On the other hand, for example, when the global IP address of the
[0036]
Referring to FIG. 2, the
[0037]
The
[0038]
The port
[0039]
Referring to FIG. 3, the address conversion table 130 holds a correspondence relationship between the
[0040]
Based on the address conversion table 130, the
[0041]
Referring to FIG. 4, the port state table 140 holds a
[0042]
For example, in the first entry, it can be seen that the TCP port number “22” of the
[0043]
The in-use
[0044]
Next, an operation example in the embodiment of the present invention will be described.
[0045]
Referring to FIG. 5, first, the terminal 390 on the
[0046]
In response to the
[0047]
Upon receiving the
[0048]
Next, the
[0049]
The
[0050]
The terminal 390 outputs a packet including a
[0051]
The
[0052]
Upon receiving the service request 1003, the
[0053]
The
[0054]
Next, an operation example of the global port
[0055]
It is assumed that the port assignment request can include designation of the number of ports to be assigned (Num), designation of a start port number (Pstart), and designation of limiting to a continuous number. That is, when the start port number is specified, the port acquisition fails if the requested number of ports cannot be acquired from the specified start port number. If it is specified that the number is limited to the serial number, the port acquisition has failed if the requested number of ports cannot be acquired by the serial number.
[0056]
In this
[0057]
Referring to FIG. 6, it is first determined whether or not a start port number is specified in the port assignment request (step S901). If the start port number is not specified, a port initial value is generated (step S911). For the generation of the initial port value, it is more preferable to use a random number for security reasons.
[0058]
On the other hand, if the start port number is designated, port acquisition is attempted from the start port number. Prior to that, it is determined whether or not the start port number is within the acquisition target range (step S902). That is, if the minimum value held in the port definition file 152 (FIG. 2) is Pmin and the maximum value is Pmax,
Pmin ≦ Pstart ≦ Pmax−
If it satisfies, it is within the scope of acquisition. If the start port number is out of the acquisition target range, the fact that the specified value is incorrect is returned (step S940).
[0059]
If the designated start port number is within the range to be acquired (step S902), the set
[0060]
On the other hand, when the port initial value is generated without specifying the start port number (step S911), the set
[0061]
Next, a specific example of processing in the embodiment of the present invention will be described.
[0062]
Referring to FIG. 7, an example of a packet 3900 of a port assignment request 3901 (FIG. 5) includes an
[0063]
Thus, in the packet from
[0064]
The
[0065]
Referring to FIG. 8, an example of the packet 2100 of the reply 2101 (FIG. 5) includes an
[0066]
Thus, in the packet from the
[0067]
The
[0068]
FIG. 9 and FIG. 10 are specific examples of HTTP. In the case of HTTP, a GET command can be used as the first line in FIG. 9 as the port
[0069]
When the port assignment request command by HTTP is executed in this way, a response as shown in the
[0070]
When receiving the packet including the
[0071]
This situation is shown in FIG. Referring to FIG. 11, the
[0072]
12 and 13 show a specific example by RTSP. In the case of RTSP, a SETUP command can be used as the port
[0073]
When the port assignment request command by RTSP is executed in this way, a response as shown in the
[0074]
When receiving the packet including the
[0075]
FIG. 14 and FIG. 15 are specific examples of SIP. In the case of SIP, an INVITE command can be used as the port
[0076]
When the SIP port assignment request command is executed in this way, a response as shown in the
[0077]
When receiving the packet including the
[0078]
As described above, according to the embodiment of the present invention, the
[0079]
Further, according to this embodiment, it is possible to specify that the number of ports to be allocated, the start port number, and the serial number are limited as port allocation parameters, and port allocation in accordance with application specifications can be realized.
[0080]
Next, a first modification of the embodiment of the present invention will be described.
[0081]
Referring to FIG. 16, in the first modification, the global port
[0082]
Next, a second modification of the embodiment of the present invention will be described.
[0083]
Referring to FIG. 17, the
[0084]
Referring to FIG. 18, the
[0085]
In the embodiment of the present invention, the HTTP protocol, the RTSP protocol, and the SIP protocol have been described as examples. However, these are examples of protocols higher than the transport layer, and the present invention is not limited to these, and the transport layer Widely applied for higher level protocols.
[0086]
【The invention's effect】
As is apparent from the above description, according to the present invention, an effect of dynamically acquiring and assigning a global port number in response to a port assignment request to a server on a local network can be obtained.
[Brief description of the drawings]
FIG. 1 is a diagram showing a system configuration using an address translation apparatus according to the present invention.
FIG. 2 is a block diagram showing a configuration of an embodiment of an address translation device according to the present invention.
FIG. 3 is a diagram showing a configuration example of an address conversion table in the present invention.
FIG. 4 is a diagram showing a configuration example of a port state table in the present invention.
FIG. 5 is a sequence diagram showing an operation example of the embodiment of the address translation device according to the present invention.
FIG. 6 is a flowchart showing a global port number assignment processing procedure in the present invention.
FIG. 7 is a diagram illustrating a configuration example of a packet including a port assignment request command according to the present invention.
FIG. 8 is a diagram showing a configuration example of a packet including an assigned port number in the present invention.
FIG. 9 is a diagram showing a configuration example of a port assignment request command by HTTP in the present invention.
FIG. 10 is a diagram showing a configuration example of a port number assignment result report by HTTP in the present invention.
FIG. 11 is a diagram showing a correspondence example of a port number assignment result by HTTP in the present invention.
FIG. 12 is a diagram showing a configuration example of a port assignment request command by RTSP in the present invention.
FIG. 13 is a diagram showing a configuration example of a port number assignment result report by RTSP in the present invention.
FIG. 14 is a diagram showing a configuration example of a port assignment request command by SIP in the present invention.
FIG. 15 is a diagram showing a configuration example of a port number assignment result report by SIP in the present invention.
FIG. 16 is a sequence diagram showing an operation example in the first modification of the embodiment of the address translation device according to the present invention;
FIG. 17 is a block diagram showing a configuration of a second modification of the embodiment of the address translation device according to the present invention;
FIG. 18 is a sequence diagram showing an operation example in the second modification of the embodiment of the address translation device according to the present invention.
[Explanation of symbols]
100 address converter
110 Communication Department
120 Packet analyzer
130 Address conversion table
131 Global IP address
132 Global port number
133 Local IP address
134 Local port number
135 Protocol
140 Port status table
141 Port number
142 protocol
143 Port status
144 Connection destination
150 Port assignment processing part
151 Control unit
152 Port definition file
153 Setting port search part
154 Port search section in use
160 Server proxy
170 Proxy storage
200 campus network
210 server
290 terminal
300 Wide area network
390 terminal
2100,3900 packets
2110, 3910 IP header
2120, 3920 TCP header
2130, 3930 Data area
2111, 3911 Source IP address
2112, 3912 Destination IP address
2121, 3921 Source port number
2122, 3922 Destination port number
2132 Port number
3931 Port allocation request command
Claims (7)
トランスポート層より高位のプロトコルにおいて交換される前記第2のネットワークの第2のポート番号を前記第2のネットワークのパケットから抽出するパケット解析手段と、
前記第2のポート番号を前記第1のネットワークの第1のポート番号に差し替えて第1のネットワークへのパケットを生成する通信手段と、
前記第1のネットワークからのポート割当て要求を受けて前記第1のポート番号を取得して割り当てるポート割当て処理手段と
を具備し、
前記ポート割当て処理手段は、
アドレス変換テーブルにおいて既に設定されている第1のポート番号を検索する設定ポート検索手段と、
ポート状態テーブルにおいて既に使用されている第1のポート番号を検索する使用中ポート検索手段と、
前記設定ポート検索手段により設定されていないことが確認され且つ前記使用中ポート検索手段により使用されていないことが確認された第1のポート番号の中から前記割当て要求におけるポート数およびポート番号の条件に従って第1のポート番号を取得する制御手段と
を備える
ことを特徴とするアドレス変換装置。An address translation device for connecting a first network and a second network,
Packet analysis means for extracting a second port number of the second network exchanged in a protocol higher than a transport layer from a packet of the second network;
Communication means for generating a packet to the first network by replacing the second port number with the first port number of the first network ;
Port allocation processing means for acquiring and allocating the first port number in response to a port allocation request from the first network;
Comprising
The port assignment processing means includes:
Setting port search means for searching for the first port number already set in the address conversion table;
In-use port search means for searching for the first port number already used in the port status table;
Number of ports and port number conditions in the allocation request from among the first port numbers confirmed not to be set by the set port search means and confirmed not to be used by the in-use port search means Control means for obtaining a first port number according to
Address conversion device according to claim <br/> comprise a.
前記制御手段は、前記開始番号の指定が無い場合にはポート初期値を乱数により発生して、このポート初期値を開始番号として第1のポート番号を取得する
ことを特徴とする請求項1記載のアドレス変換装置。The allocation request includes, as the port number condition , whether or not a start number of the first port number to be allocated is specified,
Wherein, wherein when the specified start number is not generated by a random number port initial value, according to claim 1, wherein the acquiring the first port number that port initial value as the starting number Address translation device.
前記制御手段は、前記割当て要求に含まれる開始番号から第1のポート番号を取得する
ことを特徴とする請求項1記載のアドレス変換装置。The allocation request includes designation of a start number of a first port number to be allocated as a condition of the port number;
The control means, the address translator of claim 1, wherein the acquiring the first port number from the start number included in the allocation request.
取得対象となる第1のポート番号の最小値と最大値とを保持するポート定義ファイルをさらに具備し、
前記制御手段は、前記ポート定義ファイルにおける前記最小値から前記最大値の範囲において前記第1のポート番号の取得を行う
ことを特徴とする請求項1記載のアドレス変換装置。The port assignment processing means includes:
A port definition file that holds a minimum value and a maximum value of the first port number to be acquired;
The control means, the address translator of claim 1, wherein the performing acquisition of the first port number in a range of the maximum value from the minimum value in the port definition file.
前記制御手段は、前記割当て要求に含まれる開始番号が前記最小値から前記最大値の範囲にあるか否かを判断して、前記最小値から前記最大値の範囲にあれば前記開始番号から第1のポート番号を取得し、前記最小値から前記最大値の範囲になければ開始番号指定エラーを通知する
ことを特徴とする請求項4記載のアドレス変換装置。The allocation request includes designation of a start number of a first port number to be allocated as a condition of the port number;
The control means determines whether or not a start number included in the allocation request is within a range from the minimum value to the maximum value. If the start number is within the range from the minimum value to the maximum value, 5. The address translation apparatus according to claim 4 , wherein a port number of 1 is acquired and a start number designation error is notified if the port number is not within the range from the minimum value to the maximum value.
前記制御手段は、前記割当て要求が前記連続番号に限る旨の指定を含む場合には第1のポート番号として連続番号を取得できなければ取得失敗とし、前記割当て要求が前記連続番号に限る旨の指定を含まない場合には連続番号を取得できなければ非連続番号の取得を行う
ことを特徴とする請求項1記載のアドレス変換装置。The allocation request includes designation as to whether the first port number to be allocated is limited to a serial number as a condition of the port number;
The control means, if the assignment request includes a designation that the serial number is limited to the serial number, if the serial number cannot be acquired as the first port number, the acquisition is failed, and the allocation request is limited to the serial number. address converter according to claim 1, wherein the performing acquisition of non-contiguous numbers to be able to retrieve the sequence number in the case of not including specification.
トランスポート層より高位のプロトコルにおいて交換される前記第2のネットワークの第2のポート番号を前記第2のネットワークのパケットから抽出するパケット解析手段と、
前記第2のポート番号を前記第1のネットワークの第1のポート番号に差し替えて第1のネットワークへのパケットを生成する通信手段と、
前記第1のネットワークからのポート割当て要求を受けて前記第1のポート番号を取得して割り当てるポート割当て処理手段と、
前記第2のネットワークに接続されるサーバの記憶領域のコピーを保持するプロキシ記憶手段と、
前記プロキシ記憶手段を参照して、前記割当て要求におけるポート数およびポート番号の条件に従い第2のポート番号を取得して前記第2のネットワークのパケットを生成するサーバ代理手段と
を具備することを特徴とするアドレス変換装置。An address translation device for connecting a first network and a second network,
Packet analysis means for extracting a second port number of the second network exchanged in a protocol higher than a transport layer from a packet of the second network;
Communication means for generating a packet to the first network by replacing the second port number with the first port number of the first network ;
Port allocation processing means for acquiring and allocating the first port number in response to a port allocation request from the first network;
Proxy storage means for holding a copy of a storage area of a server connected to the second network;
Server proxy means for referring to the proxy storage means and obtaining a second port number in accordance with the port number and port number conditions in the assignment request and generating a packet of the second network; An address translation device characterized by:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002226960A JP4019848B2 (en) | 2002-08-05 | 2002-08-05 | Address translation device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002226960A JP4019848B2 (en) | 2002-08-05 | 2002-08-05 | Address translation device |
Publications (3)
Publication Number | Publication Date |
---|---|
JP2004072291A JP2004072291A (en) | 2004-03-04 |
JP2004072291A5 JP2004072291A5 (en) | 2005-10-27 |
JP4019848B2 true JP4019848B2 (en) | 2007-12-12 |
Family
ID=32014121
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002226960A Expired - Lifetime JP4019848B2 (en) | 2002-08-05 | 2002-08-05 | Address translation device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4019848B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20220030040A1 (en) * | 2009-09-07 | 2022-01-27 | Iii Holdings 6, Llc | Set-Up of Media Stream Transmission and Server and Client for Media Stream Transmission |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4555592B2 (en) * | 2004-03-31 | 2010-10-06 | 富士通株式会社 | Packet processing system |
JP5034988B2 (en) * | 2008-02-06 | 2012-09-26 | 日本電気株式会社 | NAPT device and RTP packet delivery method |
JP4540720B2 (en) * | 2008-04-02 | 2010-09-08 | 株式会社エヌ・ティ・ティ・ドコモ | Data communication terminal, proxy device, data communication system, and data communication method |
JP5018800B2 (en) * | 2009-02-10 | 2012-09-05 | ブラザー工業株式会社 | Data receiving terminal and computer program |
JP5488094B2 (en) * | 2010-03-19 | 2014-05-14 | 富士通株式会社 | COMMUNICATION DEVICE, NETWORK ACCESS METHOD, AND COMPUTER PROGRAM |
JP2014039135A (en) * | 2012-08-15 | 2014-02-27 | Nec Corp | Napt device, communication system, and port number granting method used for the same, and program for the same |
JP7427951B2 (en) * | 2019-12-16 | 2024-02-06 | ブラザー工業株式会社 | Programs, program groups, and information processing devices |
-
2002
- 2002-08-05 JP JP2002226960A patent/JP4019848B2/en not_active Expired - Lifetime
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20220030040A1 (en) * | 2009-09-07 | 2022-01-27 | Iii Holdings 6, Llc | Set-Up of Media Stream Transmission and Server and Client for Media Stream Transmission |
Also Published As
Publication number | Publication date |
---|---|
JP2004072291A (en) | 2004-03-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5842290B2 (en) | Session start protocol adapter | |
US7779158B2 (en) | Network device | |
JP4349766B2 (en) | Address translation device | |
JP4660624B2 (en) | IP network interconnection system, interconnection method and SIP message routing method using different IP address systems | |
US7203166B1 (en) | Method for providing voice-over-IP service | |
JP5051728B2 (en) | Method and system for transmitting data between nodes connected to different IP environments by assigning a fake address | |
KR20050070119A (en) | Method and apparatus allowing remote access in data networks | |
CN1623310A (en) | Communications protocols operable through network address translation (nat) type devices | |
KR100607993B1 (en) | System and method for communication between heterogeneous networks | |
JP2007527068A (en) | Address and port number abstraction when setting up a connection between at least two computing devices | |
US9602333B2 (en) | DNS server, gateways and methods for managing an identifier of a port range in the transmission of data | |
JP4019848B2 (en) | Address translation device | |
CN111711705B (en) | Method and device for realizing network connection based on bidirectional NAT (network Address translation) by proxy node | |
JP6521762B2 (en) | HTTP server, control method therefor, image forming apparatus and program | |
JP4078594B2 (en) | Information processing apparatus and method, and program | |
JP4889620B2 (en) | IP packet relay method and gateway device in communication network | |
JP3890253B2 (en) | Gateway device with address conversion function and address conversion method thereof | |
Petit-Huguenin et al. | Session Description Protocol (SDP) Offer/Answer Procedures for Interactive Connectivity Establishment (ICE) | |
JP2007043751A (en) | Address conversion device, message processing method and device | |
JP4793477B2 (en) | Address translation apparatus, message processing method and apparatus | |
JP4350030B2 (en) | Address translation method | |
JP4350029B2 (en) | Address translation system | |
JP2005244306A (en) | Remote maintenance method of network | |
Petit-Huguenin et al. | RFC 8839: Session Description Protocol (SDP) Offer/Answer Procedures for Interactive Connectivity Establishment (ICE) | |
JP2004172730A (en) | Application level gateway in application layer |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20050727 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050727 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20070405 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070619 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070817 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20070904 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070917 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101005 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101005 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111005 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121005 Year of fee payment: 5 |