xref: /freebsd-13.1/share/examples/IPv6/USAGE (revision 9dbbb282)
180d21dc4SYoshinobu Inoue	USAGE
280d21dc4SYoshinobu Inoue	KAME Project
333841545SHajimu UMEMOTO	$KAME: USAGE,v 1.33 2000/11/22 10:22:57 itojun Exp $
480d21dc4SYoshinobu Inoue	$FreeBSD$
580d21dc4SYoshinobu Inoue
6*9dbbb282STom RhodesThis is an introduction of how to use the commands provided in the KAME
780d21dc4SYoshinobu Inouekit.  For more information, please refer to each man page.
880d21dc4SYoshinobu Inoue
933841545SHajimu UMEMOTO
1080d21dc4SYoshinobu Inoue<<<ifconfig>>>
1180d21dc4SYoshinobu Inoue
1280d21dc4SYoshinobu InoueA link-local address is automatically assigned to each interface, when
1380d21dc4SYoshinobu Inouethe interface becomes up for the first time.  Even if you find an interface
1480d21dc4SYoshinobu Inouewithout a link-local address, do not panic.  The link-local address will be
1580d21dc4SYoshinobu Inoueassigned when it becomes up (with "ifconfig IF up").
1680d21dc4SYoshinobu Inoue
1733841545SHajimu UMEMOTOIf you do not see a link-local address assigned to an interface on "ifconfig
1833841545SHajimu UMEMOTOup", the interface does not support IPv6 for some reasons - for example,
1933841545SHajimu UMEMOTOif the interface does not support link-layer multicast (IFF_MULTICAST is not
2033841545SHajimu UMEMOTOset), the interface cannot be used for IPv6.
2133841545SHajimu UMEMOTO
2280d21dc4SYoshinobu InoueSome network drivers allow an interface to become up even without a
2380d21dc4SYoshinobu Inouehardware address (for example, PCMCIA network cards).  In such cases, it is
2480d21dc4SYoshinobu Inouepossible that an interface has no link-local address even if the
2580d21dc4SYoshinobu Inoueinterface is up.  If you see such situation, please disable the
2680d21dc4SYoshinobu Inoueinterface once and then re-enable it (i.e. do `ifconfig IF down;
2780d21dc4SYoshinobu Inoueifconfig IF up').
2880d21dc4SYoshinobu Inoue
2933841545SHajimu UMEMOTOPseudo interfaces (like "gif" tunnel device) will borrow IPv6
3033841545SHajimu UMEMOTOinterface identifier (lowermost 64bit of the address) from
3133841545SHajimu UMEMOTOEUI64/IEEE802 sources, like ethernet cards.  Pseudo interfaces will be
3233841545SHajimu UMEMOTOable to get an IPv6 link-local address, if you have other "real"
3333841545SHajimu UMEMOTOinterface configured beforehand.  If you have no EUI64/IEEE802 sources
3433841545SHajimu UMEMOTOon the node, we have last-resort code in the kernel, which generates
3533841545SHajimu UMEMOTOinterface identifier from MD5(hostname).  MD5(hostname) may not be suitable
3633841545SHajimu UMEMOTOfor your usage (for example, if you configure same hostname on both sides of
3733841545SHajimu UMEMOTOgif tunnel, you will be doomed), and if so, you may need to configure
3833841545SHajimu UMEMOTOlink-local address manually.
3933841545SHajimu UMEMOTOSee RFC2472 for more discussion on how to generate an interface ID for
4033841545SHajimu UMEMOTOpseudo interfaces.
4180d21dc4SYoshinobu Inoue
4280d21dc4SYoshinobu InoueIf you have a router announcing Router Advertisement,
4333841545SHajimu UMEMOTOglobal addresses will be assigned automatically.  So, neither
4433841545SHajimu UMEMOTO"ifconfig" nor "prefix" is necessary for your *host* (non-router node).
4533841545SHajimu UMEMOTO(Please refer to "sysctl" section for configuring a host to accept
4633841545SHajimu UMEMOTORouter Advertisement.)
4780d21dc4SYoshinobu Inoue
4880d21dc4SYoshinobu InoueIf you want to set up a router, you need to assign global addresses
4933841545SHajimu UMEMOTOfor two or more interfaces by "ifconfig" or "prefix" (prefix command
5033841545SHajimu UMEMOTOis described at next section).
5180d21dc4SYoshinobu InoueIf you want to assign a global address by "ifconfig", don't forget to
5280d21dc4SYoshinobu Inouespecify the "alias" argument to keep the link-local address.
5380d21dc4SYoshinobu Inoue
5433841545SHajimu UMEMOTO# ifconfig de0 inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 alias
5580d21dc4SYoshinobu Inoue# ifconfig de0
5680d21dc4SYoshinobu Inouede0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
5733841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
5833841545SHajimu UMEMOTO        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
5933841545SHajimu UMEMOTO        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64
6080d21dc4SYoshinobu Inoue        ether 00:00:f8:01:63:17
6133841545SHajimu UMEMOTO        media: 100baseTX status: active
6280d21dc4SYoshinobu Inoue
6380d21dc4SYoshinobu InoueSee also "/etc/rc.network6" for actual examples.
6480d21dc4SYoshinobu Inoue
6580d21dc4SYoshinobu Inoue<<prefix>>
6680d21dc4SYoshinobu Inoue
6733841545SHajimu UMEMOTOIn the IPv6 architecture, an IPv6 address of an interface can be
6833841545SHajimu UMEMOTOgenerated from a prefix assigned to the interface, and a
6933841545SHajimu UMEMOTOlink-dependent identifier for the interface.  So assigning a full IPv6
7033841545SHajimu UMEMOTOaddress by ifconfig is not necessary anymore, because user can only
7133841545SHajimu UMEMOTOtake care of prefix, by letting system take care of interface
7233841545SHajimu UMEMOTOidentifier.
7380d21dc4SYoshinobu Inoue
7480d21dc4SYoshinobu InoueThe newly added "prefix" command enables user to just assign prefixes
7580d21dc4SYoshinobu Inouefor interfaces, and let your system automatically generate IPv6
7680d21dc4SYoshinobu Inoueaddresses.  Prefixes added by the "prefix" command is maintained in
7780d21dc4SYoshinobu Inouethe kernel consistently with prefixes assigned by Router
7833841545SHajimu UMEMOTOAdvertisement (in case of hosts) and with prefixes assigned by Router
7933841545SHajimu UMEMOTORenumbering (in case of routers).  Manual assignment of prefixes or
8033841545SHajimu UMEMOTOchange of prefix properties take precedence over ones assigned by
8133841545SHajimu UMEMOTORouter Advertisement or Router Renumbering.
8280d21dc4SYoshinobu Inoue
8333841545SHajimu UMEMOTOprefix command works only on routers.
8480d21dc4SYoshinobu Inoue
8533841545SHajimu UMEMOTOIf you want to assign a prefix (and consequently address) manually, do
8680d21dc4SYoshinobu Inoueas follows:
8780d21dc4SYoshinobu Inoue
8880d21dc4SYoshinobu Inoue# ifconfig de0
8980d21dc4SYoshinobu Inouede0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
9033841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
9133841545SHajimu UMEMOTO        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
9280d21dc4SYoshinobu Inoue        ether 00:00:f8:01:63:17
9333841545SHajimu UMEMOTO        media: 100baseTX status: active
9433841545SHajimu UMEMOTO# prefix de0 3ffe:501:808:1::
9533841545SHajimu UMEMOTO# ifconfig de0
9633841545SHajimu UMEMOTOde0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
9733841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
9833841545SHajimu UMEMOTO        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
9933841545SHajimu UMEMOTO        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64
10033841545SHajimu UMEMOTO        ether 00:00:f8:01:63:17
10133841545SHajimu UMEMOTO        media: 100baseTX status: active
10280d21dc4SYoshinobu Inoue
10333841545SHajimu UMEMOTOTo check assigned prefix, use the "ndp" command (See description of
10433841545SHajimu UMEMOTOndp command about its usage).
10580d21dc4SYoshinobu Inoue
10680d21dc4SYoshinobu Inoue# ndp -p
10733841545SHajimu UMEMOTO3ffe:501:808:1::/64 if=de0
10833841545SHajimu UMEMOTO  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
10980d21dc4SYoshinobu Inoue  No advertising router
11080d21dc4SYoshinobu Inoue
11180d21dc4SYoshinobu InoueThe "prefix" command also has node internal prefix renumbering
11280d21dc4SYoshinobu Inoueability.
11380d21dc4SYoshinobu Inoue
11433841545SHajimu UMEMOTOIf you have multiple prefixes which have 3ffe:501:808:/48 at the top,
11533841545SHajimu UMEMOTOand would like to renumber them to 3ffe:501:4819:/48, then use the
11680d21dc4SYoshinobu Inoue"prefix" command with the "matchpr" argument and the "usepr" argument.
11780d21dc4SYoshinobu Inoue
11880d21dc4SYoshinobu InoueSuppose that current state of before renumbering as follows:
11980d21dc4SYoshinobu Inoue
12080d21dc4SYoshinobu Inoue# ifconfig de0
12180d21dc4SYoshinobu Inouede0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
12233841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
12333841545SHajimu UMEMOTO        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
12433841545SHajimu UMEMOTO        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64
12580d21dc4SYoshinobu Inoue        ether 00:00:f8:01:63:17
12633841545SHajimu UMEMOTO        media: 100baseTX status: active
12780d21dc4SYoshinobu Inoue# ifconfig de1
12880d21dc4SYoshinobu Inouede1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
12933841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe55:7011%de1 prefixlen 64 scopeid 0x2
13033841545SHajimu UMEMOTO        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
13133841545SHajimu UMEMOTO        inet6 3ffe:501:808:2:200:f8ff:fe55:7011 prefixlen 64
13280d21dc4SYoshinobu Inoue        ether 00:00:f8:55:70:11
13333841545SHajimu UMEMOTO        media: 100baseTX status: active
13480d21dc4SYoshinobu Inoue# ndp -p
13533841545SHajimu UMEMOTO3ffe:501:808:1::/64 if=de0
13633841545SHajimu UMEMOTO  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
13780d21dc4SYoshinobu Inoue  No advertising router
13833841545SHajimu UMEMOTO3ffe:501:808:2::/64 if=de1
13933841545SHajimu UMEMOTO  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
14080d21dc4SYoshinobu Inoue  No advertising router
14180d21dc4SYoshinobu Inoue
14280d21dc4SYoshinobu InoueThen do as follows:
14380d21dc4SYoshinobu Inoue
14433841545SHajimu UMEMOTO# prefix -a matchpr 3ffe:501:808:: mp_len 48 usepr 3ffe:501:4819:: up_uselen 48 change
14580d21dc4SYoshinobu Inoue
14680d21dc4SYoshinobu InoueIf command is successful, prefixes and addresses will be renumbered as
14780d21dc4SYoshinobu Inouefollows.
14880d21dc4SYoshinobu Inoue
14980d21dc4SYoshinobu Inoue# ifconfig de0
15080d21dc4SYoshinobu Inouede0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
15133841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
15233841545SHajimu UMEMOTO        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
15333841545SHajimu UMEMOTO        inet6 3ffe:501:4819:1:200:f8ff:fe01:6317 prefixlen 64
15480d21dc4SYoshinobu Inoue        ether 00:00:f8:01:63:17
15533841545SHajimu UMEMOTO        media: 100baseTX status: active
15680d21dc4SYoshinobu Inoue# ifconfig de1
15780d21dc4SYoshinobu Inouede1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
15833841545SHajimu UMEMOTO        inet6 fe80::200:f8ff:fe55:7011%de0 prefixlen 64 scopeid 0x2
15933841545SHajimu UMEMOTO        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
16033841545SHajimu UMEMOTO        inet6 3ffe:501:4819:2:200:f8ff:fe55:7011 prefixlen 64
16180d21dc4SYoshinobu Inoue        ether 00:00:f8:55:70:11
16233841545SHajimu UMEMOTO        media: 100baseTX status: active
16380d21dc4SYoshinobu Inoue# ndp -p
16433841545SHajimu UMEMOTO3ffe:501:4819:1::/64 if=de0
16533841545SHajimu UMEMOTO  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
16680d21dc4SYoshinobu Inoue  No advertising router
16733841545SHajimu UMEMOTO3ffe:501:4819:2::/64 if=de1
16833841545SHajimu UMEMOTO  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
16980d21dc4SYoshinobu Inoue  No advertising router
17080d21dc4SYoshinobu Inoue
17180d21dc4SYoshinobu InoueSee also "/etc/rc.network6" for actual examples.
17280d21dc4SYoshinobu Inoue
17333841545SHajimu UMEMOTO
17480d21dc4SYoshinobu Inoue<<<route>>>
17580d21dc4SYoshinobu Inoue
17633841545SHajimu UMEMOTOIf there is a router announcing Router Advertisement on a subnet,
17733841545SHajimu UMEMOTOyou need not to add a default route for your host by hand
17833841545SHajimu UMEMOTO(Please refer to "sysctl" section to accept Router Advertisement).
17980d21dc4SYoshinobu Inoue
18033841545SHajimu UMEMOTOIf you want to add a default route manually, do like:
18180d21dc4SYoshinobu Inoue
18233841545SHajimu UMEMOTO# route add -inet6 default fe80::200:a2ff:fe0e:7543%ed0
18380d21dc4SYoshinobu Inoue
18433841545SHajimu UMEMOTO"default" means ::/0.  In other cases, if "prefixlen" is omitted, 64
18533841545SHajimu UMEMOTOis assumed for "prefixlen" to get along with the aggregatable address.
18680d21dc4SYoshinobu Inoue
18733841545SHajimu UMEMOTONote that, in IPv6, a link-local address should be used as gateway
18833841545SHajimu UMEMOTO("fe80::200:a2ff:fe0e:7543%ed0" in the above).  If you use global addresses,
18933841545SHajimu UMEMOTOICMPv6 redirect will not work properly.  Also note that we use a special form
19033841545SHajimu UMEMOTOof link-local address as gateway.  See Section 1.3 of IMPLEMENTATION for
19133841545SHajimu UMEMOTOmore details.
19233841545SHajimu UMEMOTOFor ease of configuration we recommend you to avoid static routes and run
19333841545SHajimu UMEMOTOa routing daemon (route6d for example) instead.
19480d21dc4SYoshinobu Inoue
19533841545SHajimu UMEMOTO
19633841545SHajimu UMEMOTO<<<ping6>>>
19780d21dc4SYoshinobu Inoue
19880d21dc4SYoshinobu InoueReachability can be checked by "ping6".  This "ping6" allows multicast
19980d21dc4SYoshinobu Inouefor its argument.
20080d21dc4SYoshinobu Inoue
20133841545SHajimu UMEMOTO% ping6 -n -I ed0 ff02::1
20280d21dc4SYoshinobu Inoue
20333841545SHajimu UMEMOTOPING6(56=40+8+8 bytes) fe80::5254:ff:feda:cb7d --> ff02::1%ed0
20433841545SHajimu UMEMOTO56 bytes from fe80::5254:ff:feda:cb7d%lo0, icmp_seq=0 hlim=64 time=0.25 ms
20533841545SHajimu UMEMOTO56 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0, icmp_seq=0 hlim=64 time=1.333 ms(DUP!)
20633841545SHajimu UMEMOTO56 bytes from fe80::5254:ff:feda:d161%ed0, icmp_seq=0 hlim=64 time=1.459 ms(DUP!)
20733841545SHajimu UMEMOTO56 bytes from fe80::260:97ff:fec2:80bf%ed0, icmp_seq=0 hlim=64 time=1.538 ms(DUP!)
20833841545SHajimu UMEMOTO56 bytes from 3ffe:501:4819:2000:5054:ff:fedb:aa46, icmp_seq=0 hlim=255 time=1.615 ms(DUP!)
20933841545SHajimu UMEMOTO
21080d21dc4SYoshinobu Inoue
21180d21dc4SYoshinobu Inoue<<<ping6 -w>>>
21280d21dc4SYoshinobu Inoue
21380d21dc4SYoshinobu InoueName resolution is possible by ICMPv6 node information query message.
21480d21dc4SYoshinobu InoueThis is very convenient for link-local addresses whose host name cannot be
21580d21dc4SYoshinobu Inoueresolved by DNS.  Specify the "-w" option to "ping6".
21680d21dc4SYoshinobu Inoue
21733841545SHajimu UMEMOTO% ping6 -n -I ed0 -w ff02::1
21880d21dc4SYoshinobu Inoue
21933841545SHajimu UMEMOTO64 bytes from fe80::5254:ff:feda:cb7d%lo0: fto.kame.net
22033841545SHajimu UMEMOTO67 bytes from fe80::5254:ff:feda:d161%ed0: banana.kame.net
22133841545SHajimu UMEMOTO69 bytes from fe80::2a0:c9ff:fe84:ebd9%ed0: paradise.kame.net
22233841545SHajimu UMEMOTO66 bytes from fe80::260:8ff:fe8b:447f%ed0: taroh.kame.net
22333841545SHajimu UMEMOTO66 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0: ayame.kame.net
22433841545SHajimu UMEMOTO
22580d21dc4SYoshinobu Inoue
22680d21dc4SYoshinobu Inoue<<<traceroute6>>>
22780d21dc4SYoshinobu Inoue
22880d21dc4SYoshinobu InoueThe route for a target host can be checked by "traceroute6".
22980d21dc4SYoshinobu Inoue
23080d21dc4SYoshinobu Inoue% traceroute6 tokyo.v6.wide.ad.jp
23180d21dc4SYoshinobu Inoue
23280d21dc4SYoshinobu Inouetraceroute to tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923), 30 hops max, 12 byte packets
23380d21dc4SYoshinobu Inoue 1  nr60.v6.kame.net  1.239 ms  0.924 ms  0.908 ms
23480d21dc4SYoshinobu Inoue 2  otemachi.v6.wide.ad.jp  28.953 ms  31.451 ms  26.567 ms
23580d21dc4SYoshinobu Inoue 3  tokyo.v6.wide.ad.jp  26.549 ms  26.58 ms  26.186 ms
23680d21dc4SYoshinobu Inoue
23780d21dc4SYoshinobu InoueIf the -l option is specified, both address and name are shown in each line.
23880d21dc4SYoshinobu Inoue% traceroute6 -l tokyo.v6.wide.ad.jp
23980d21dc4SYoshinobu Inoue
24080d21dc4SYoshinobu Inouetraceroute to tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923), 30 hops max, 12 byte packets
24180d21dc4SYoshinobu Inoue 1  nr60.v6.kame.net (3ffe:501:4819:2000:260:97ff:fec2:80bf)  1.23 ms  0.952 ms  0.92 ms
24280d21dc4SYoshinobu Inoue 2  otemachi.v6.wide.ad.jp (3ffe:501:0:1802:260:97ff:feb6:7ff0)  27.345 ms  26.706 ms  26.563 ms
24380d21dc4SYoshinobu Inoue 3  tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923)  26.329 ms  26.36 ms  28.63 ms
24480d21dc4SYoshinobu Inoue
24533841545SHajimu UMEMOTO
24680d21dc4SYoshinobu Inoue<<<ndp>>>
24780d21dc4SYoshinobu Inoue
24880d21dc4SYoshinobu InoueTo display the current Neighbor cache, use "ndp":
24980d21dc4SYoshinobu Inoue
25080d21dc4SYoshinobu Inoue% ndp -a
25180d21dc4SYoshinobu InoueNeighbor                      Linklayer Address   Netif Expire    St Flgs Prbs
25233841545SHajimu UMEMOTOnr60.v6.kame.net              0:60:97:c2:80:bf      ed0  expired   S    R
25333841545SHajimu UMEMOTO3ffe:501:4819:2000:2c0:cff:fe 0:c0:c:10:3a:53       ed0  permanent R
25433841545SHajimu UMEMOTOparadise.v6.kame.net          52:54:0:dc:52:17      ed0  expired   S    R
25533841545SHajimu UMEMOTOfe80::200:eff:fe49:f929%ed0   0:0:e:49:f9:29        ed0  expired   S    R
25633841545SHajimu UMEMOTOfe80::200:86ff:fe05:80da%ed0  0:0:86:5:80:da        ed0  expired   S
25733841545SHajimu UMEMOTOfe80::200:86ff:fe05:c2d8%ed0  0:0:86:5:c2:d8        ed0  9s        R
25880d21dc4SYoshinobu Inoue
25933841545SHajimu UMEMOTOTo flush all of the NDP cache entries, execute the following as root.
26080d21dc4SYoshinobu Inoue
26180d21dc4SYoshinobu Inoue# ndp -c
26280d21dc4SYoshinobu Inoue
26333841545SHajimu UMEMOTOTo display the prefix list:
26480d21dc4SYoshinobu Inoue
26580d21dc4SYoshinobu Inoue% ndp -p
26633841545SHajimu UMEMOTO3ffe:501:4819:2000::/64 if=ed0
26733841545SHajimu UMEMOTO  flags=LA, vltime=2592000, pltime=604800, expire=29d23h59m58s, origin=RA
26880d21dc4SYoshinobu Inoue  advertised by
26933841545SHajimu UMEMOTO    fe80::5254:ff:fedc:5217%ed0 (reachable)
27033841545SHajimu UMEMOTO    fe80::260:97ff:fec2:80bf%ed0 (reachable)
27133841545SHajimu UMEMOTO    fe80::200:eff:fe49:f929%ed0 (no neighbor state)
27280d21dc4SYoshinobu Inoue
27333841545SHajimu UMEMOTOTo display the default router list:
27480d21dc4SYoshinobu Inoue
27580d21dc4SYoshinobu Inoue% ndp -r
27633841545SHajimu UMEMOTOfe80::260:97ff:fec2:80bf if=ed0, flags=, expire=29m55s
27733841545SHajimu UMEMOTOfe80::5254:ff:fedc:5217 if=ed0, flags=, expire=29m7s
27833841545SHajimu UMEMOTOfe80::200:eff:fe49:f929 if=ed0, flags=, expire=28m47s
27933841545SHajimu UMEMOTO
28080d21dc4SYoshinobu Inoue
28180d21dc4SYoshinobu Inoue<<<rtsol>>>
28280d21dc4SYoshinobu Inoue
28380d21dc4SYoshinobu InoueTo generate a Router Solicitation message right now to get global
28480d21dc4SYoshinobu Inoueaddresses, use "rtsol".
28580d21dc4SYoshinobu Inoue
28633841545SHajimu UMEMOTO# ifconfig ef0
28733841545SHajimu UMEMOTOef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
28833841545SHajimu UMEMOTO        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
28933841545SHajimu UMEMOTO        media 10baseT status active
29033841545SHajimu UMEMOTO        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
29133841545SHajimu UMEMOTO# rtsol ef0
29233841545SHajimu UMEMOTO# ifconfig ef0
29333841545SHajimu UMEMOTOef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
29433841545SHajimu UMEMOTO        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
29533841545SHajimu UMEMOTO        media 10baseT status active
29633841545SHajimu UMEMOTO        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
29733841545SHajimu UMEMOTO        inet6 3ffe:501:4819:2000:2a0:24ff:feab:839b prefixlen 64
29880d21dc4SYoshinobu Inoue
29980d21dc4SYoshinobu Inoue
30080d21dc4SYoshinobu Inoue<<<rtsold>>>
30180d21dc4SYoshinobu Inoue
30280d21dc4SYoshinobu Inouertsold is a daemon version of rtsol.  If you run KAME IPv6 on a laptop
30380d21dc4SYoshinobu Inouecomputer and frequently move with it, the daemon is useful since it watches
30480d21dc4SYoshinobu Inouethe interface and sends router solicitations when the status of the interface
30580d21dc4SYoshinobu Inouechanges.  Note, however, that the feature is disabled by default.  Please
30633841545SHajimu UMEMOTOadd -m option when invocation of rtsold.
30780d21dc4SYoshinobu Inoue
30880d21dc4SYoshinobu Inouertsold also supports multiple interfaces.  For example, you can
30980d21dc4SYoshinobu Inoueinvoke the daemon as follows:
31033841545SHajimu UMEMOTO
31180d21dc4SYoshinobu Inoue# rtsold -m ep0 cnw0
31280d21dc4SYoshinobu Inoue
31333841545SHajimu UMEMOTO
31480d21dc4SYoshinobu Inoue<<<netstat>>>
31580d21dc4SYoshinobu Inoue
31680d21dc4SYoshinobu InoueTo see routing table:
31780d21dc4SYoshinobu Inoue
31880d21dc4SYoshinobu Inoue# netstat -nr
31933841545SHajimu UMEMOTO# netstat -nrl
32033841545SHajimu UMEMOTO	long format with Ref and Use.  Note that bsdi4 does not support the
32133841545SHajimu UMEMOTO	-l option.  You should use the -O option instead.
32233841545SHajimu UMEMOTO
32380d21dc4SYoshinobu Inoue
32480d21dc4SYoshinobu Inoue<<<sysctl>>>
32580d21dc4SYoshinobu Inoue
32680d21dc4SYoshinobu InoueIf "net.inet6.ip6.accept_rtadv" is 1, Router Advertisement is
32780d21dc4SYoshinobu Inoueaccepted.  This means that global addresses and default route are
32880d21dc4SYoshinobu Inoueautomatically set up.  Otherwise, the announcement is rejected.  The
32980d21dc4SYoshinobu Inouedefault value is 0.  To set "net.inet6.ip6.accept_rtadv" to 1, execute
33080d21dc4SYoshinobu Inoueas follows:
33180d21dc4SYoshinobu Inoue
332ff8ac0d5SDima Dorfman# sysctl net.inet6.ip6.accept_rtadv=1
33380d21dc4SYoshinobu Inoue
33433841545SHajimu UMEMOTO
33580d21dc4SYoshinobu Inoue<<<gifconfig>>>
33680d21dc4SYoshinobu Inoue
33780d21dc4SYoshinobu Inoue"gif" interface enables you to perform IPv{4,6} over IPv{4,6}
33880d21dc4SYoshinobu Inoueprotocol tunneling.  To use this interface, you must specify the
33980d21dc4SYoshinobu Inoueouter IPv{4,6} address by using gifconfig, like:
34080d21dc4SYoshinobu Inoue
34133841545SHajimu UMEMOTO# gifconfig gif0 163.221.198.61 163.221.11.21
34280d21dc4SYoshinobu Inoue
34380d21dc4SYoshinobu Inoue"ifconfig gif0" will configure the address pair used for inner
34480d21dc4SYoshinobu InoueIPv{4,6} header.
34580d21dc4SYoshinobu Inoue
34680d21dc4SYoshinobu InoueIt is not required to configure inner IPv{4,6} address pair.  If
34780d21dc4SYoshinobu Inoueyou do not configure inner IPv{4,6} address pair, tunnel link is
34880d21dc4SYoshinobu Inoueconsidered as un-numbered link and the source address of inner
34980d21dc4SYoshinobu InoueIPv{4,6} address pair will be borrowed from other interfaces.
35080d21dc4SYoshinobu Inoue
35180d21dc4SYoshinobu InoueThe following example configures un-numbered IPv6-over-IPv4 tunnel:
35280d21dc4SYoshinobu Inoue# gifconfig gif0 10.0.0.1 10.0.0.1 netmask 255.255.255.0
35380d21dc4SYoshinobu Inoue
35480d21dc4SYoshinobu InoueThe following example configures numbered IPv6-over-IPv4 tunnel:
35580d21dc4SYoshinobu Inoue# gifconfig gif0 10.0.0.1 10.0.0.1 netmask 255.255.255.0
35633841545SHajimu UMEMOTO# ifconfig gif0 inet6 3ffe:501:808:5::1 3ffe:501:808:5::2 prefixlen 64 alias
35780d21dc4SYoshinobu Inoue
35880d21dc4SYoshinobu InoueIPv6 spec allows you to use point-to-point link without global IPv6
35980d21dc4SYoshinobu Inoueaddress assigned to the interface.  Routing protocol (such as RIPng)
36080d21dc4SYoshinobu Inoueuses link-local addresses only.  If you are to configure IPv6-over-IPv4
36180d21dc4SYoshinobu Inouetunnel, you need not to configure an address pair for inner IPv6
36280d21dc4SYoshinobu Inoueheader.  We suggest you to use the former example (un-numbered
36333841545SHajimu UMEMOTOIPv6-over-IPv4 tunnel) to connect to 6bone for simplicity.
36480d21dc4SYoshinobu Inoue
36580d21dc4SYoshinobu InoueNote that it is so easy to make an infinite routing loop using gif
36680d21dc4SYoshinobu Inoueinterface, if you configure a tunnel using the same protocol family
36780d21dc4SYoshinobu Inouefor inner and outer header (i.e. IPv4-over-IPv4).
36880d21dc4SYoshinobu Inoue
36980d21dc4SYoshinobu InoueRefer to gifconfig(8) for more details.
37080d21dc4SYoshinobu Inoue
37133841545SHajimu UMEMOTO
37233841545SHajimu UMEMOTO<<<6to4>>>
37333841545SHajimu UMEMOTO
37433841545SHajimu UMEMOTOWARNING: malicious party can abuse 6to4 relay routers/sites, read through
37533841545SHajimu UMEMOTOinternet draft draft-itojun-ipv6-transition-abuse-xx.txt before configuring it.
37633841545SHajimu UMEMOTO
37733841545SHajimu UMEMOTO"stf" interface enables you to perform 6to4 IPv6-over-IPv4 encapsulation,
37833841545SHajimu UMEMOTOas documented in draft-ietf-ngtrans-6to4-06.txt.  See stf(4) for details.
37933841545SHajimu UMEMOTO
38033841545SHajimu UMEMOTO
38180d21dc4SYoshinobu Inoue<<<inetd>>>
38280d21dc4SYoshinobu Inoue
38380d21dc4SYoshinobu InoueInetd supports AF_INET and AF_INET6 sockets, with IPsec policy
38480d21dc4SYoshinobu Inoueconfiguration support.
38580d21dc4SYoshinobu Inoue
38680d21dc4SYoshinobu InoueRefer to inetd(8) for more details.
38780d21dc4SYoshinobu Inoue
38833841545SHajimu UMEMOTO
38980d21dc4SYoshinobu Inoue<<<IPsec>>>
39080d21dc4SYoshinobu Inoue
39133841545SHajimu UMEMOTOIPsec requires fairly complex configuration, so here we show transport
39233841545SHajimu UMEMOTOmode only.  http://www.kame.net/newsletter/ has more comprehensive
39333841545SHajimu UMEMOTOexamples.
39480d21dc4SYoshinobu Inoue
39533841545SHajimu UMEMOTOLet us setup security association to deploy a secure channel between
39680d21dc4SYoshinobu InoueHOST A (10.2.3.4) and HOST B (10.6.7.8).  Here we show a little
39780d21dc4SYoshinobu Inouecomplicated example.  From HOST A to HOST B, only old AH is used.
39880d21dc4SYoshinobu InoueFrom HOST B to HOST A, new AH and new ESP are combined.
39980d21dc4SYoshinobu Inoue
40080d21dc4SYoshinobu InoueNow we should choose algorithm to be used corresponding to "AH"/"new
40180d21dc4SYoshinobu InoueAH"/"ESP"/"new ESP".  Please refer to the "setkey" man page to know
40280d21dc4SYoshinobu Inouealgorithm names.  Our choice is MD5 for AH, new-HMAC-SHA1 for new AH,
40380d21dc4SYoshinobu Inoueand new-DES-expIV with 8 byte IV for new ESP.
40480d21dc4SYoshinobu Inoue
40580d21dc4SYoshinobu InoueKey length highly depends on each algorithm.  For example, key
40680d21dc4SYoshinobu Inouelength must be equal to 16 bytes for MD5, 20 for new-HMAC-SHA1,
40780d21dc4SYoshinobu Inoueand 8 for new-DES-expIV.  Now we choose "MYSECRETMYSECRET",
40880d21dc4SYoshinobu Inoue"KAMEKAMEKAMEKAMEKAME", "PASSWORD", respectively.
40980d21dc4SYoshinobu Inoue
41033841545SHajimu UMEMOTOOK, let us assign SPI (Security Parameter Index) for each protocol.
41180d21dc4SYoshinobu InouePlease note that we need 3 SPIs for this secure channel since three
41280d21dc4SYoshinobu Inouesecurity headers are produced (one for from HOST A to HOST B, two for
41380d21dc4SYoshinobu Inouefrom HOST B to HOST A).  Please also note that SPI MUST be greater
41480d21dc4SYoshinobu Inouethan or equal to 256.  We choose, 1000, 2000, and 3000, respectively.
41580d21dc4SYoshinobu Inoue
41680d21dc4SYoshinobu Inoue
41780d21dc4SYoshinobu Inoue	         (1)
41880d21dc4SYoshinobu Inoue	HOST A ------> HOST B
41980d21dc4SYoshinobu Inoue
42080d21dc4SYoshinobu Inoue	(1)PROTO=AH
42180d21dc4SYoshinobu Inoue		ALG=MD5(RFC1826)
42280d21dc4SYoshinobu Inoue		KEY=MYSECRETMYSECRET
42380d21dc4SYoshinobu Inoue		SPI=1000
42480d21dc4SYoshinobu Inoue
42580d21dc4SYoshinobu Inoue	         (2.1)
42680d21dc4SYoshinobu Inoue	HOST A <------ HOST B
42780d21dc4SYoshinobu Inoue	       <------
42880d21dc4SYoshinobu Inoue	         (2.2)
42980d21dc4SYoshinobu Inoue
43080d21dc4SYoshinobu Inoue	(2.1)
43180d21dc4SYoshinobu Inoue	PROTO=AH
43280d21dc4SYoshinobu Inoue		ALG=new-HMAC-SHA1(new AH)
43380d21dc4SYoshinobu Inoue		KEY=KAMEKAMEKAMEKAMEKAME
43480d21dc4SYoshinobu Inoue		SPI=2000
43580d21dc4SYoshinobu Inoue
43680d21dc4SYoshinobu Inoue	(2.2)
43780d21dc4SYoshinobu Inoue	PROTO=ESP
43880d21dc4SYoshinobu Inoue		ALG=new-DES-expIV(new ESP)
43980d21dc4SYoshinobu Inoue			IV length = 8
44080d21dc4SYoshinobu Inoue		KEY=PASSWORD
44180d21dc4SYoshinobu Inoue		SPI=3000
44280d21dc4SYoshinobu Inoue
44333841545SHajimu UMEMOTONow, let us setup security association.  Execute "setkey" on both HOST
44480d21dc4SYoshinobu InoueA and B:
44580d21dc4SYoshinobu Inoue
44680d21dc4SYoshinobu Inoue# setkey -c
44780d21dc4SYoshinobu Inoueadd 10.2.3.4 10.6.7.8 ah  1000 -m transport -A keyed-md5 "MYSECRETMYSECRET" ;
44880d21dc4SYoshinobu Inoueadd 10.6.7.8 10.2.3.4 ah  2000 -m transport -A hmac-sha1 "KAMEKAMEKAMEKAMEKAME" ;
44980d21dc4SYoshinobu Inoueadd 10.6.7.8 10.2.3.4 esp 3000 -m transport -E des-cbc "PASSWORD" ;
45080d21dc4SYoshinobu Inoue^D
45180d21dc4SYoshinobu Inoue
45280d21dc4SYoshinobu InoueActually, IPsec communication doesn't process until security policy
45380d21dc4SYoshinobu Inoueentries will be defined.  In this case, you must setup each host.
45480d21dc4SYoshinobu Inoue
45580d21dc4SYoshinobu InoueAt A:
45680d21dc4SYoshinobu Inoue# setkey -c
45780d21dc4SYoshinobu Inouespdadd 10.2.3.4 10.6.7.8 any -P out ipsec
45880d21dc4SYoshinobu Inoue	ah/transport/10.2.3.4-10.6.7.8/require ;
45980d21dc4SYoshinobu Inoue^D
46080d21dc4SYoshinobu Inoue
46180d21dc4SYoshinobu InoueAt B:
46280d21dc4SYoshinobu Inouespdadd 10.6.7.8 10.2.3.4 any -P out ipsec
46333841545SHajimu UMEMOTO	esp/transport//require
46433841545SHajimu UMEMOTO	ah/transport//require ;
46580d21dc4SYoshinobu Inoue^D
46680d21dc4SYoshinobu Inoue
46780d21dc4SYoshinobu InoueTo utilize the security associations installed into the kernel, you
46880d21dc4SYoshinobu Inouemust set the socket security level by using setsockopt().
46980d21dc4SYoshinobu InoueThis is per-application (or per-socket) security.  For example,
47080d21dc4SYoshinobu Inouethe "ping" command has the -P option with parameter to enable AH and/or ESP.
47180d21dc4SYoshinobu Inoue
47280d21dc4SYoshinobu InoueFor example:
47380d21dc4SYoshinobu Inoue% ping -P "out ipsec \
47433841545SHajimu UMEMOTO	ah/transport//use \
47580d21dc4SYoshinobu Inoue	esp/tunnel/10.0.1.1-10.0.1.2/require" 10.0.2.2
47680d21dc4SYoshinobu Inoue
47780d21dc4SYoshinobu InoueIf there are proper SAs, this policy specification causes ICMP packet
47880d21dc4SYoshinobu Inoueto be AH transport mode inner ESP tunnel mode like below.
47980d21dc4SYoshinobu Inoue
48080d21dc4SYoshinobu Inoue	   HOST C -----------> GATEWAY D ----------> HOST E
48180d21dc4SYoshinobu Inoue	  10.0.1.1        10.0.1.2   10.0.2.1       10.0.2.2
48280d21dc4SYoshinobu Inoue	    | |                 |                    |
48380d21dc4SYoshinobu Inoue	    | ======= ESP =======                    |
48480d21dc4SYoshinobu Inoue	    ==================== AH ==================
48580d21dc4SYoshinobu Inoue
48680d21dc4SYoshinobu Inoue
487ce6282dbSHajimu UMEMOTO<<<EDNS0>>>
488ce6282dbSHajimu UMEMOTO
489ce6282dbSHajimu UMEMOTOEDNS0 is defined in RFC2671.  With EDNS0, the resolver library can tell DNS
490ce6282dbSHajimu UMEMOTOserver of its receiving buffer size, and permit DNS server to transmit large
491ce6282dbSHajimu UMEMOTOreply packet.  EDNS0 is necessary to take advantage of larger minimum MTU
492ce6282dbSHajimu UMEMOTOin IPv6.  KAME libinet6 includes resolver side support for EDNS0.
493ce6282dbSHajimu UMEMOTOServer side support for EDNS0 is included in ISC BIND9.
494ce6282dbSHajimu UMEMOTO
495ce6282dbSHajimu UMEMOTO	query packet with EDNS0
496ce6282dbSHajimu UMEMOTO	tells receive buffer size
497ce6282dbSHajimu UMEMOTOKAME box -----------------------------> BIND9 DNS server
498ce6282dbSHajimu UMEMOTOKAME box <----------------------------- BIND9 DNS server
499ce6282dbSHajimu UMEMOTO	can transmit jumbo reply, since DNS server
500ce6282dbSHajimu UMEMOTO	knows receive buffer size of KAME box
501ce6282dbSHajimu UMEMOTO
502ce6282dbSHajimu UMEMOTOHow to play with it:
503ce6282dbSHajimu UMEMOTO- prepare KAME box and BIND9 DNS server (can be a same node)
504ce6282dbSHajimu UMEMOTO- add the following into /etc/resolv.conf on KAME box:
505ce6282dbSHajimu UMEMOTO	options edns0		<--- enables EDNS0
506ce6282dbSHajimu UMEMOTO	nameserver <IPv4 or v6 address of BIND9 box>
507ce6282dbSHajimu UMEMOTO- run applications compiled with libinet6 (like /usr/local/v6/bin/telnet),
508ce6282dbSHajimu UMEMOTO  see EDNS0 packet fly on the wire by tcpdump or some other method.
509ce6282dbSHajimu UMEMOTO
510ce6282dbSHajimu UMEMOTOCaveats:
511ce6282dbSHajimu UMEMOTO- BIND 4/8 DNS server will choke with EDNS0 packet, so you must not
512ce6282dbSHajimu UMEMOTO  turn the option on if you have BIND 4/8 DNS server.  If you enable
513ce6282dbSHajimu UMEMOTO  "options edns0" against BIND 4/8 DNS server, you will never be able
514ce6282dbSHajimu UMEMOTO  to resolve names.
515ce6282dbSHajimu UMEMOTO- If you use IPv6 UDP as DNS transport, path MTU discovery may
516ce6282dbSHajimu UMEMOTO  affect the traffic.  KAME box tries to fragment packet to 1280
517ce6282dbSHajimu UMEMOTO  bytes, however, BIND9 may not.
518ce6282dbSHajimu UMEMOTO- Some of our platforms do not use our extended resolver code in libinet6.
519ce6282dbSHajimu UMEMOTO  See COVERAGE for detail.
520ce6282dbSHajimu UMEMOTO
52133841545SHajimu UMEMOTO
52233841545SHajimu UMEMOTO<<Further readings>>
52333841545SHajimu UMEMOTO
52433841545SHajimu UMEMOTOhttp://www.netbsd.org/Documentation/network/ipv6/
52533841545SHajimu UMEMOTO	Even if you are on non-netbsd operating system, the URL should be
52633841545SHajimu UMEMOTO	useful.
52733841545SHajimu UMEMOTOhttp://www.kame.net/
52833841545SHajimu UMEMOTO
52980d21dc4SYoshinobu Inoue							<end of USAGE>
530