$Id: howto-gated.html,v 1.1.1.1 1999/10/26 17:19:15 sakane Exp $
%Hd: gated の使い方
o gated を突っ込む。
BSDI2.1p27
勝手(?)に R3_5Alpha_11p3.5B1 が載ってる。
FreeBSD2.2.2R
packages/net に R3_5_5 がある。
後は、
ftp://sh.wide.ad.jp/routing/gated-R3_5Alpha/gated-R3_5Alpha_9.tar.gz
とか
o SunOS4.1.4 に突っ込んで見る。
o gated を使うための準備
- IP forwarding させる。
方法1 sysctl を使う(BSDI,FreeBSD とか)
# sysctl -w net.inet.ip.forwarding=1
方法2 デバッガを使う(SunOS とか)
adb:
# echo 'ip_forwarding/W 1' | adb -k -w /vmunix /dev/mem
dbx:
# echo 'assign ip_forwarding = 1' | dbx -k /vmunix
- カーネルにUDPチェックサムを計算させる。
方法1 sysctl を使う(BSDI,FreeBSD とか)
# sysctl -w net.inet.udp.checksum=1
方法2 デバッガを使う(SunOS とか)
adb:
# echo 'udp_cksum/W1' | adb -k -w /vmunix /dev/mem
dbx:
# echo 'assign udp_cksum = 1' | dbx -k /vmunix
- /etc/protocols に以下を追加する。やらなくても動作するが気持悪いのでやる。
%cat /etc/protocols
ospf 89 OSPF # OSPF
o gated を使う
とりあえず軽く man gated してみる。
ドキュメントは必要に応じて眺める。
設定した gated.conf のチェックをしたい場合は、
% gated -c -f (full path)/gated.conf
-c は設定ファイルをチェックした後、/var/tmp/gated_dump を吐く。
チェックだけなので root じゃなくても起動可能。
戯言:
interface に alias を使用している場合、その経路の広告が direct では、うまく行かない。
この時、例えば、
% ifconfig ef0 inet 10.0.0.1 netmask 255.255.255.0
% ifconfig ef0 inet alias 10.0.1.1
とすると、10.0.0.1 を direct で exportして、10.0.1.1 を
static { 10.0.1.0 masklen 24 interface 10.0.1.1; }
として、static で export すると旨く広告出来る。これで正しい?
interface のマニュアルに、
An interface is the connection between a router and one of its attached networks.
とあるので、alias は direct では使用できないのか?
o gdc
gdc dump
統計情報を /usr/tmp/gated_dump に吐かせる。
gdc term
gated を殺す。
gdc reconfig
gated.conf を再読み込みさせる。
gdc toggletrace
trace を止めたりする。
--------------------------------------------------------------------------------
gated.conf
o 設定例
- Area border router が Area を持たずにOSPFで経路を広告する方法。
export の direct, kernel, static 等を使用する。
o ステートメントの記述順序
gated.conf で使用するステートメントは、複数のタイプ(statement type)に分けられている。
以下の順で記述しないと gated.conf の構文解析時にエラーになる。
definition-options
definition-interface
definition-others
protocol
static
control-export/import
control-others
ただし、次の2つのタイプは、どこにでも存在できる。
directive
trace
o definition
options
gated.conf の先頭に位置しなければならない。
options
[ nosend ]
[ noresolv ]
[ gendefault [ preference < preference > ] [ gateway < gateway >] ]
[ syslog [ upto ] < log_level > ]
[ mark < time > ]
;
interfaces
インターフェイスの定義をする。
interfaces {
options
[ strictinterfaces ]
[ scaninterval < time > ]
;
interface
< interface_list >
[ preference < preference > ]
[ down preference < preference > ]
[ passive ]
[ simplex ]
[ reject ]
[ blackhole ]
;
define
< address >
[ broadcast < address > ] | [ pointtopoint < address > ]
[ netmask < mask > ]
[ multicast ]
;
} ;
gated 起動時にインターフェイスが無ければ、この設定を評価して起動するようなことが
書いてあるが。うまく行かない…
passive
Prevents GateD from changing the preference of the route to this interface if it
is not believed to be functioning properly due to lack of received routing information.
GateD will only perform this check if the interface is actively participating
in a routing protocol.
autonomoussystem
AS番号を定義する。
autonomoussystem < autonomous_system > [ loops < number > ] ;
routerid
BGP, OSPF で使用するルータIDを指定する。
routerid host ;
martians
信用しないIPアドレスを指定する。
martians {
host host [ allow ] ;
network [ allow ] ;
network mask mask [ allow ] ;
network masklen number [ allow ] ;
default [ allow ] ;
} ;
protocol
rip
RIP プロトコルに関する定義
rip yes | no | on | off [ {
broadcast ;
nobroadcast ;
nocheckzero ;
preference < preference > ;
defaultmetric < metric > ;
query authentication [none | [[simple|md5] < password >]] ;
interface < interface_list >
[noripin] | [ripin]
[noripout] | [ripout]
[metricin < metric >]
[metricout < metric >]
[version 1]|[version 2 [multicast|broadcast]]
[[secondary] authentication [none | [[simple|md5] < password >]] ;
trustedgateways < gateway_list > ;
sourcegateways < gateway_list > ;
traceoptions < trace_options > ;
} ] ;
trace_options
traceoptions のオプションに加えて以下が使用可能。
packets, request, response, other
Any other
hello
HELLO プロトコル
isis
ISIS プロトコル
kernel
configures kernel interface options.
ospf
OSPF プロトコルに関する定義
ospf yes | no | on | off [ {
defaults {
preference < preference > ;
cost < cost > ;
tag [ as ] < tag > ;
type < 1 | 2 > ;
} ;
exportlimit < routes > ;
exportinterval < time > ;
traceoptions < trace_options > ;
monitorauthkey < authkey > ;
monitorauth none | ( [ simple | md5 ] < authkey > ) ;
backbone | ( area < area > ) {
authtype < 0 | 1 | none | simple > ;
stub [ cost < cost >] ;
networks {
< network > [ restrict ] ;
< network > mask < mask > [ restrict ] ;
< network > masklen < number > [ restrict ] ;
host < host > [ restrict ] ;
} ;
stubhosts {
< host > cost < cost > ;
} ;
interface < interface_list > [cost < cost > ] {
< interface_parameters >
} ;
interface < interface_list > nonbroadcast [cost < cost > ] {
pollinterval < time > ;
routers {
< gateway > [ eligible ] ;
} ;
< interface_parameters >
} ;
[ virtuallink neighborid < router_id > transitarea < area > {
< interface_parameters >
} ; ]
} ;
} ] ;
interface_parameters の項目
enable | disable ;
retransmitinterval < time > ;
transitdelay < time > ;
priority < priority > ;
hellointerval < time > ;
routerdeadinterval < time > ;
authkey "< auth_key >" ;
nomulticast ;
authtype
none = 0, simple = 1
OSPF固有の trace options
lsabuild Link State Advertisement creation
spf SPFが計算された
hello OSPF HELLO パケット
dd OSPF Database Description パケット
request OSPF Link State Request パケット
lsu OSPF Link State Update パケット <---- 動かないぞ?
ack OSPF Link State Ack パケット
type
1 cost を加算しながら伝搬する。
2 設定したメトリックが伝搬する。
1 が優先して伝搬するみたい…
egp
EGP プロトコル
bgp
BGP プロトコル
redirect
ICMP redirect に関する設定
icmp
ICMPに関する設定
snmp
SNMP プロトコル
static
static
gated が使用する static な経路を設定する。
preference を使用して他の経路情報と調整が出来る。
static {
( host < host > ) | default |
( < network > [ ( mask < mask > ) | ( masklen < number > ) ] )
gateway < gateway_list >
[ interface < interface_list > ]
[ preference < preference > ]
[ retain ]
[ reject ]
[ blackhole ]
[ noinstall ] ;
( < network > [ ( mask < mask > ) | ( masklen < number > ) ] )
interface < interface >
[ preference < preference > ]
[ retain ]
[ reject ]
[ blackhole ]
[ noinstall ] ;
} ;
retain
gated が死んだ時も経路を残す。
control
import
インポートに関する設定。export とほぼ同じ。
export
広告する方法を設定。
direct, kernel を除いて、export するデータを gated が持っていないと無視される。
BGP, EGP によるアナウンス。
export proto bgp | egp as autonomous system restrict ;
export proto bgp | egp as autonomous system [ metric metric ] {
export_list ;
} ;
OSPFによるアナウンス。
export proto ospfase [ type 1 | 2 ] [ tag ospf_tag ] restrict ;
export proto ospfase [ type 1 | 2 ] [ tag < ospf_tag > ] [ metric < metric > ] {
< export_list > ;
} ;
RIP, HELLO によるアナウンス。
export proto rip | hello [ ( interface interface_list ) | (gateway gateway_list ) ] restrict ;
export proto rip | hello [ ( interface interface_list ) | (gateway gateway_list ) ] [ metric metric ] {
export_list ;
} ;
広告する情報の種類 export_list の設定
全て。
all [ restrict | (metric < metric > ) ];
OSPFによる経路情報。
proto ospf | ospfase restrict ;
proto ospf | ospfase [ metric < metric > ] {
< route_filter > [ restrict | ( metric < metric > ) ] ;
} ;
直接接続されているインターフェイスへの経路。
proto direct [ (interface < interface_list > ) ] restrict ;
proto direct [ (interface < interface_list > ) ] [ metric metric ] {
< route_filter > [ restrict | ( metric < metric > ) ] ;
} ;
static 文で設定された経路情報。
proto static [ (interface < interface_list > ) ] restrict ;
proto static [ (interface < interface_list > ) ] [ metric metric ] {
< route_filter > [ restrict | ( metric < metric > ) ] ;
} ;
route(8) コマンド等で kernel へ設定された経路。
proto kernel [ (interface < interface_list > ) ] restrict ;
proto kernel [ (interface < interface_list > ) ] [ metric metric ] {
< route_filter > [ restrict | ( metric < metric > ) ] ;
} ;
route_filter の設定
network [ exact | refines ]
network mask < mask > [exact | refines ]
network masklen < number > [ exact | refines ]
default
host < host >
aggregate
defines which routes to aggregate.
generate
defines which routes to generate.
コメント
# から改行まで、または /*, */ で囲む。
優先順 (preference)
デフォルトは、
Preference Of Defined by Statement Default
direct connnected networks interface 0
OSPF routes ospf 10
IS-IS level 1 routes isis level 1 15
IS-IS level 2 routes isis level 2 18
internally generated default gendefault 20
redirects redirect 30
routes learned via route socket kernel 40
static routes from config static 60
ANS SPF (SLSP) routes slsp 70
HELLO routes hello 90
RIP routes rip 100
point-to-point interface 110
routes to interfaces that are down interfaces 120
aggregate/generate routes aggregate/generate 130
OSPF AS external routes ospf 150
BGP routes bgp 170
EGP egp 200
o directive
gated は全てのプロトコルを1つのファイルで定義出来るのが特徴なので、
あまり使わない方が良いらしい。
%directory
gated.confに読み込むファイルのディレクトリを指定する。
%include
gated.confに読み込むファイルを指定する。
o trace
traceoptions
トレースに関する指定。
traceoptions
["< trace_file >" [replace] [size < size >[k|m] files < files >]]
[control_options]
< trace_options >
[except < trace_options >]
;
または
traceoptions none ;
trace_options
スペースで区切る。
none トレースしない
all nostamp を除く全て
general internal,external,route と同義
internal 内部エラー
external 外部エラー
nostamp タイムスタンプを付加しない
route gatedの経路テーブルの更新
kernel kernelの経路テーブルの更新
bgp BGP による経路テーブルの更新
egp EGP による経路テーブルの更新
rip RIP による経路テーブルの更新
hello HELLO による経路テーブルの更新
icmp ICMP による経路テーブルの更新
snmp SNMP による経路テーブルの更新
その他
mark, task, timer, lex, parse, config, protocol, update