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