head	1.6;
access;
symbols
	RELENG_8_4:1.6.0.2
	RELENG_9_1_0_RELEASE:1.5.40.1.4.2
	RELENG_9_1:1.5.40.1.0.4
	RELENG_9_1_BP:1.5.40.1
	RELENG_8_3_0_RELEASE:1.5.34.1.8.1
	RELENG_8_3:1.5.34.1.0.8
	RELENG_8_3_BP:1.5.34.1
	RELENG_9_0_0_RELEASE:1.5.40.1.2.1
	RELENG_9_0:1.5.40.1.0.2
	RELENG_9_0_BP:1.5.40.1
	RELENG_9:1.5.0.40
	RELENG_9_BP:1.5
	RELENG_7_4_0_RELEASE:1.5.38.1
	RELENG_8_2_0_RELEASE:1.5.34.1.6.1
	RELENG_7_4:1.5.0.38
	RELENG_7_4_BP:1.5
	RELENG_8_2:1.5.34.1.0.6
	RELENG_8_2_BP:1.5.34.1
	RELENG_8_1_0_RELEASE:1.5.34.1.4.1
	RELENG_8_1:1.5.34.1.0.4
	RELENG_8_1_BP:1.5.34.1
	RELENG_7_3_0_RELEASE:1.5.36.1
	RELENG_7_3:1.5.0.36
	RELENG_7_3_BP:1.5
	RELENG_8_0_0_RELEASE:1.5.34.1.2.1
	RELENG_8_0:1.5.34.1.0.2
	RELENG_8_0_BP:1.5.34.1
	RELENG_8:1.5.0.34
	RELENG_8_BP:1.5
	RELENG_7_2_0_RELEASE:1.5.32.1
	RELENG_7_2:1.5.0.32
	RELENG_7_2_BP:1.5
	RELENG_7_1_0_RELEASE:1.5.30.1
	RELENG_6_4_0_RELEASE:1.5.28.1
	RELENG_7_1:1.5.0.30
	RELENG_7_1_BP:1.5
	RELENG_6_4:1.5.0.28
	RELENG_6_4_BP:1.5
	RELENG_7_0_0_RELEASE:1.5
	RELENG_6_3_0_RELEASE:1.5
	RELENG_7_0:1.5.0.26
	RELENG_7_0_BP:1.5
	RELENG_6_3:1.5.0.24
	RELENG_6_3_BP:1.5
	RELENG_7:1.5.0.22
	RELENG_7_BP:1.5
	RELENG_6_2_0_RELEASE:1.5
	RELENG_6_2:1.5.0.20
	RELENG_6_2_BP:1.5
	RELENG_5_5_0_RELEASE:1.5
	RELENG_5_5:1.5.0.18
	RELENG_5_5_BP:1.5
	RELENG_6_1_0_RELEASE:1.5
	RELENG_6_1:1.5.0.16
	RELENG_6_1_BP:1.5
	RELENG_6_0_0_RELEASE:1.5
	RELENG_6_0:1.5.0.14
	RELENG_6_0_BP:1.5
	RELENG_6:1.5.0.12
	RELENG_6_BP:1.5
	RELENG_5_4_0_RELEASE:1.5
	RELENG_5_4:1.5.0.10
	RELENG_5_4_BP:1.5
	RELENG_4_11_0_RELEASE:1.1.2.2
	RELENG_4_11:1.1.2.2.0.16
	RELENG_4_11_BP:1.1.2.2
	RELENG_5_3_0_RELEASE:1.5
	RELENG_5_3:1.5.0.8
	RELENG_5_3_BP:1.5
	RELENG_5:1.5.0.6
	RELENG_5_BP:1.5
	RELENG_4_10_0_RELEASE:1.1.2.2
	RELENG_4_10:1.1.2.2.0.14
	RELENG_4_10_BP:1.1.2.2
	RELENG_5_2_1_RELEASE:1.5
	RELENG_5_2_0_RELEASE:1.5
	RELENG_5_2:1.5.0.4
	RELENG_5_2_BP:1.5
	RELENG_4_9_0_RELEASE:1.1.2.2
	RELENG_4_9:1.1.2.2.0.12
	RELENG_4_9_BP:1.1.2.2
	RELENG_5_1_0_RELEASE:1.5
	RELENG_5_1:1.5.0.2
	RELENG_5_1_BP:1.5
	RELENG_4_8_0_RELEASE:1.1.2.2
	RELENG_4_8:1.1.2.2.0.10
	RELENG_4_8_BP:1.1.2.2
	RELENG_5_0_0_RELEASE:1.4
	RELENG_5_0:1.4.0.2
	RELENG_5_0_BP:1.4
	RELENG_4_7_0_RELEASE:1.1.2.2
	RELENG_4_7:1.1.2.2.0.8
	RELENG_4_7_BP:1.1.2.2
	RELENG_4_6_2_RELEASE:1.1.2.2
	RELENG_4_6_1_RELEASE:1.1.2.2
	RELENG_4_6_0_RELEASE:1.1.2.2
	RELENG_4_6:1.1.2.2.0.6
	RELENG_4_6_BP:1.1.2.2
	RELENG_4_5_0_RELEASE:1.1.2.2
	RELENG_4_5:1.1.2.2.0.4
	RELENG_4_5_BP:1.1.2.2
	RELENG_4_4_0_RELEASE:1.1.2.2
	RELENG_4_4:1.1.2.2.0.2
	RELENG_4_4_BP:1.1.2.2
	RELENG_4_3_0_RELEASE:1.1
	RELENG_4_3:1.1.0.4
	RELENG_4_3_BP:1.1
	RELENG_4_2_0_RELEASE:1.1
	RELENG_4_1_1_RELEASE:1.1
	PRE_SMPNG:1.1
	RELENG_4_1_0_RELEASE:1.1
	RELENG_4_0_0_RELEASE:1.1
	RELENG_4:1.1.0.2
	RELENG_4_BP:1.1;
locks; strict;
comment	@# @;


1.6
date	2012.11.17.01.50.31;	author svnexp;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2002.12.19.22.56.20;	author trhodes;	state Exp;
branches
	1.5.12.1
	1.5.22.1
	1.5.28.1
	1.5.30.1
	1.5.32.1
	1.5.34.1
	1.5.36.1
	1.5.38.1
	1.5.40.1;
next	1.4;

1.4
date	2002.05.11.05.55.05;	author dd;	state Exp;
branches;
next	1.3;

1.3
date	2001.06.11.12.38.47;	author ume;	state Exp;
branches;
next	1.2;

1.2
date	2001.06.10.20.25.24;	author ume;	state Exp;
branches;
next	1.1;

1.1
date	2000.02.26.19.44.12;	author shin;	state Exp;
branches
	1.1.2.1;
next	;

1.6.2.1
date	2012.11.17.01.50.31;	author svnexp;	state dead;
branches;
next	1.6.2.2;

1.6.2.2
date	2013.03.28.13.03.42;	author svnexp;	state Exp;
branches;
next	;

1.5.12.1
date	2012.11.17.07.41.31;	author svnexp;	state Exp;
branches;
next	;

1.5.22.1
date	2012.11.17.08.03.51;	author svnexp;	state Exp;
branches;
next	;

1.5.28.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.5.30.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.5.32.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.5.34.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.5.34.1.2.1
	1.5.34.1.4.1
	1.5.34.1.6.1
	1.5.34.1.8.1;
next	1.5.34.2;

1.5.34.2
date	2012.11.17.10.36.18;	author svnexp;	state Exp;
branches;
next	;

1.5.34.1.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.5.34.1.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.5.34.1.6.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.5.34.1.8.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.5.34.1.8.2;

1.5.34.1.8.2
date	2012.11.17.08.24.58;	author svnexp;	state Exp;
branches;
next	;

1.5.36.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.5.38.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.5.38.2;

1.5.38.2
date	2012.11.17.08.16.56;	author svnexp;	state Exp;
branches;
next	;

1.5.40.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.5.40.1.2.1
	1.5.40.1.4.1;
next	1.5.40.2;

1.5.40.2
date	2012.11.17.11.36.35;	author svnexp;	state Exp;
branches;
next	;

1.5.40.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.5.40.1.2.2;

1.5.40.1.2.2
date	2012.11.17.08.36.34;	author svnexp;	state Exp;
branches;
next	;

1.5.40.1.4.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.5.40.1.4.2;

1.5.40.1.4.2
date	2012.11.17.08.47.24;	author svnexp;	state Exp;
branches;
next	;

1.1.2.1
date	2001.06.15.22.08.30;	author ume;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.07.03.11.01.24;	author ume;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2012.11.17.07.24.44;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.6
log
@Switching exporter and resync
@
text
@	USAGE
	KAME Project
	$KAME: USAGE,v 1.33 2000/11/22 10:22:57 itojun Exp $
	$FreeBSD: head/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $

This is an introduction of how to use the commands provided in the KAME
kit.  For more information, please refer to each man page.


<<<ifconfig>>>

A link-local address is automatically assigned to each interface, when
the interface becomes up for the first time.  Even if you find an interface
without a link-local address, do not panic.  The link-local address will be
assigned when it becomes up (with "ifconfig IF up").

If you do not see a link-local address assigned to an interface on "ifconfig
up", the interface does not support IPv6 for some reasons - for example,
if the interface does not support link-layer multicast (IFF_MULTICAST is not
set), the interface cannot be used for IPv6.

Some network drivers allow an interface to become up even without a
hardware address (for example, PCMCIA network cards).  In such cases, it is
possible that an interface has no link-local address even if the
interface is up.  If you see such situation, please disable the
interface once and then re-enable it (i.e. do `ifconfig IF down;
ifconfig IF up').

Pseudo interfaces (like "gif" tunnel device) will borrow IPv6
interface identifier (lowermost 64bit of the address) from
EUI64/IEEE802 sources, like ethernet cards.  Pseudo interfaces will be
able to get an IPv6 link-local address, if you have other "real"
interface configured beforehand.  If you have no EUI64/IEEE802 sources
on the node, we have last-resort code in the kernel, which generates
interface identifier from MD5(hostname).  MD5(hostname) may not be suitable
for your usage (for example, if you configure same hostname on both sides of
gif tunnel, you will be doomed), and if so, you may need to configure
link-local address manually.
See RFC2472 for more discussion on how to generate an interface ID for
pseudo interfaces.

If you have a router announcing Router Advertisement,
global addresses will be assigned automatically.  So, neither
"ifconfig" nor "prefix" is necessary for your *host* (non-router node).
(Please refer to "sysctl" section for configuring a host to accept
Router Advertisement.)

If you want to set up a router, you need to assign global addresses
for two or more interfaces by "ifconfig" or "prefix" (prefix command
is described at next section).
If you want to assign a global address by "ifconfig", don't forget to
specify the "alias" argument to keep the link-local address.

# ifconfig de0 inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 alias
# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active

See also "/etc/rc.network6" for actual examples.

<<prefix>>

In the IPv6 architecture, an IPv6 address of an interface can be
generated from a prefix assigned to the interface, and a
link-dependent identifier for the interface.  So assigning a full IPv6
address by ifconfig is not necessary anymore, because user can only
take care of prefix, by letting system take care of interface
identifier.

The newly added "prefix" command enables user to just assign prefixes
for interfaces, and let your system automatically generate IPv6
addresses.  Prefixes added by the "prefix" command is maintained in
the kernel consistently with prefixes assigned by Router
Advertisement (in case of hosts) and with prefixes assigned by Router
Renumbering (in case of routers).  Manual assignment of prefixes or
change of prefix properties take precedence over ones assigned by
Router Advertisement or Router Renumbering.

prefix command works only on routers.

If you want to assign a prefix (and consequently address) manually, do
as follows:

# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# prefix de0 3ffe:501:808:1::
# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active

To check assigned prefix, use the "ndp" command (See description of
ndp command about its usage).

# ndp -p
3ffe:501:808:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router

The "prefix" command also has node internal prefix renumbering
ability.

If you have multiple prefixes which have 3ffe:501:808:/48 at the top,
and would like to renumber them to 3ffe:501:4819:/48, then use the
"prefix" command with the "matchpr" argument and the "usepr" argument.

Suppose that current state of before renumbering as follows:

# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# ifconfig de1
de1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe55:7011%de1 prefixlen 64 scopeid 0x2
        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
        inet6 3ffe:501:808:2:200:f8ff:fe55:7011 prefixlen 64 
        ether 00:00:f8:55:70:11
        media: 100baseTX status: active
# ndp -p
3ffe:501:808:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router
3ffe:501:808:2::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router

Then do as follows:

# prefix -a matchpr 3ffe:501:808:: mp_len 48 usepr 3ffe:501:4819:: up_uselen 48 change

If command is successful, prefixes and addresses will be renumbered as
follows.

# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:4819:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# ifconfig de1
de1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe55:7011%de0 prefixlen 64 scopeid 0x2
        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
        inet6 3ffe:501:4819:2:200:f8ff:fe55:7011 prefixlen 64 
        ether 00:00:f8:55:70:11
        media: 100baseTX status: active
# ndp -p
3ffe:501:4819:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router
3ffe:501:4819:2::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router

See also "/etc/rc.network6" for actual examples.


<<<route>>>

If there is a router announcing Router Advertisement on a subnet,
you need not to add a default route for your host by hand
(Please refer to "sysctl" section to accept Router Advertisement).

If you want to add a default route manually, do like:

# route add -inet6 default fe80::200:a2ff:fe0e:7543%ed0

"default" means ::/0.  In other cases, if "prefixlen" is omitted, 64
is assumed for "prefixlen" to get along with the aggregatable address.

Note that, in IPv6, a link-local address should be used as gateway
("fe80::200:a2ff:fe0e:7543%ed0" in the above).  If you use global addresses,
ICMPv6 redirect will not work properly.  Also note that we use a special form
of link-local address as gateway.  See Section 1.3 of IMPLEMENTATION for
more details.
For ease of configuration we recommend you to avoid static routes and run
a routing daemon (route6d for example) instead.


<<<ping6>>>

Reachability can be checked by "ping6".  This "ping6" allows multicast
for its argument.

% ping6 -n -I ed0 ff02::1

PING6(56=40+8+8 bytes) fe80::5254:ff:feda:cb7d --> ff02::1%ed0
56 bytes from fe80::5254:ff:feda:cb7d%lo0, icmp_seq=0 hlim=64 time=0.25 ms
56 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0, icmp_seq=0 hlim=64 time=1.333 ms(DUP!)
56 bytes from fe80::5254:ff:feda:d161%ed0, icmp_seq=0 hlim=64 time=1.459 ms(DUP!)
56 bytes from fe80::260:97ff:fec2:80bf%ed0, icmp_seq=0 hlim=64 time=1.538 ms(DUP!)
56 bytes from 3ffe:501:4819:2000:5054:ff:fedb:aa46, icmp_seq=0 hlim=255 time=1.615 ms(DUP!)


<<<ping6 -w>>>

Name resolution is possible by ICMPv6 node information query message.
This is very convenient for link-local addresses whose host name cannot be
resolved by DNS.  Specify the "-w" option to "ping6".

% ping6 -n -I ed0 -w ff02::1

64 bytes from fe80::5254:ff:feda:cb7d%lo0: fto.kame.net
67 bytes from fe80::5254:ff:feda:d161%ed0: banana.kame.net
69 bytes from fe80::2a0:c9ff:fe84:ebd9%ed0: paradise.kame.net
66 bytes from fe80::260:8ff:fe8b:447f%ed0: taroh.kame.net
66 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0: ayame.kame.net
	

<<<traceroute6>>>

The route for a target host can be checked by "traceroute6".

% traceroute6 tokyo.v6.wide.ad.jp

traceroute to tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923), 30 hops max, 12 byte packets
 1  nr60.v6.kame.net  1.239 ms  0.924 ms  0.908 ms
 2  otemachi.v6.wide.ad.jp  28.953 ms  31.451 ms  26.567 ms
 3  tokyo.v6.wide.ad.jp  26.549 ms  26.58 ms  26.186 ms

If the -l option is specified, both address and name are shown in each line.
% traceroute6 -l tokyo.v6.wide.ad.jp

traceroute to tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923), 30 hops max, 12 byte packets
 1  nr60.v6.kame.net (3ffe:501:4819:2000:260:97ff:fec2:80bf)  1.23 ms  0.952 ms  0.92 ms
 2  otemachi.v6.wide.ad.jp (3ffe:501:0:1802:260:97ff:feb6:7ff0)  27.345 ms  26.706 ms  26.563 ms
 3  tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923)  26.329 ms  26.36 ms  28.63 ms


<<<ndp>>>

To display the current Neighbor cache, use "ndp":

% ndp -a
Neighbor                      Linklayer Address   Netif Expire    St Flgs Prbs
nr60.v6.kame.net              0:60:97:c2:80:bf      ed0  expired   S    R 
3ffe:501:4819:2000:2c0:cff:fe 0:c0:c:10:3a:53       ed0  permanent R      
paradise.v6.kame.net          52:54:0:dc:52:17      ed0  expired   S    R 
fe80::200:eff:fe49:f929%ed0   0:0:e:49:f9:29        ed0  expired   S    R 
fe80::200:86ff:fe05:80da%ed0  0:0:86:5:80:da        ed0  expired   S      
fe80::200:86ff:fe05:c2d8%ed0  0:0:86:5:c2:d8        ed0  9s        R      

To flush all of the NDP cache entries, execute the following as root.

# ndp -c

To display the prefix list:

% ndp -p
3ffe:501:4819:2000::/64 if=ed0
  flags=LA, vltime=2592000, pltime=604800, expire=29d23h59m58s, origin=RA
  advertised by
    fe80::5254:ff:fedc:5217%ed0 (reachable)
    fe80::260:97ff:fec2:80bf%ed0 (reachable)
    fe80::200:eff:fe49:f929%ed0 (no neighbor state)

To display the default router list:

% ndp -r
fe80::260:97ff:fec2:80bf if=ed0, flags=, expire=29m55s
fe80::5254:ff:fedc:5217 if=ed0, flags=, expire=29m7s
fe80::200:eff:fe49:f929 if=ed0, flags=, expire=28m47s


<<<rtsol>>>

To generate a Router Solicitation message right now to get global
addresses, use "rtsol".

# ifconfig ef0
ef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
        media 10baseT status active
        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
# rtsol ef0
# ifconfig ef0
ef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
        media 10baseT status active
        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
        inet6 3ffe:501:4819:2000:2a0:24ff:feab:839b prefixlen 64


<<<rtsold>>>

rtsold is a daemon version of rtsol.  If you run KAME IPv6 on a laptop
computer and frequently move with it, the daemon is useful since it watches
the interface and sends router solicitations when the status of the interface
changes.  Note, however, that the feature is disabled by default.  Please
add -m option when invocation of rtsold.

rtsold also supports multiple interfaces.  For example, you can
invoke the daemon as follows:

# rtsold -m ep0 cnw0


<<<netstat>>>

To see routing table:
	
# netstat -nr
# netstat -nrl
	long format with Ref and Use.  Note that bsdi4 does not support the
	-l option.  You should use the -O option instead.


<<<sysctl>>>

If "net.inet6.ip6.accept_rtadv" is 1, Router Advertisement is
accepted.  This means that global addresses and default route are
automatically set up.  Otherwise, the announcement is rejected.  The
default value is 0.  To set "net.inet6.ip6.accept_rtadv" to 1, execute
as follows:

# sysctl net.inet6.ip6.accept_rtadv=1


<<<gifconfig>>>

"gif" interface enables you to perform IPv{4,6} over IPv{4,6}
protocol tunneling.  To use this interface, you must specify the
outer IPv{4,6} address by using gifconfig, like:

# gifconfig gif0 163.221.198.61 163.221.11.21

"ifconfig gif0" will configure the address pair used for inner
IPv{4,6} header.

It is not required to configure inner IPv{4,6} address pair.  If
you do not configure inner IPv{4,6} address pair, tunnel link is
considered as un-numbered link and the source address of inner
IPv{4,6} address pair will be borrowed from other interfaces.

The following example configures un-numbered IPv6-over-IPv4 tunnel:
# gifconfig gif0 10.0.0.1 10.0.0.1 netmask 255.255.255.0

The following example configures numbered IPv6-over-IPv4 tunnel:
# gifconfig gif0 10.0.0.1 10.0.0.1 netmask 255.255.255.0
# ifconfig gif0 inet6 3ffe:501:808:5::1 3ffe:501:808:5::2 prefixlen 64 alias

IPv6 spec allows you to use point-to-point link without global IPv6
address assigned to the interface.  Routing protocol (such as RIPng)
uses link-local addresses only.  If you are to configure IPv6-over-IPv4
tunnel, you need not to configure an address pair for inner IPv6
header.  We suggest you to use the former example (un-numbered
IPv6-over-IPv4 tunnel) to connect to 6bone for simplicity.

Note that it is so easy to make an infinite routing loop using gif
interface, if you configure a tunnel using the same protocol family
for inner and outer header (i.e. IPv4-over-IPv4).

Refer to gifconfig(8) for more details.


<<<6to4>>>

WARNING: malicious party can abuse 6to4 relay routers/sites, read through
internet draft draft-itojun-ipv6-transition-abuse-xx.txt before configuring it.

"stf" interface enables you to perform 6to4 IPv6-over-IPv4 encapsulation,
as documented in draft-ietf-ngtrans-6to4-06.txt.  See stf(4) for details.


<<<inetd>>>

Inetd supports AF_INET and AF_INET6 sockets, with IPsec policy
configuration support.

Refer to inetd(8) for more details.


<<<IPsec>>>

IPsec requires fairly complex configuration, so here we show transport
mode only.  http://www.kame.net/newsletter/ has more comprehensive
examples.

Let us setup security association to deploy a secure channel between
HOST A (10.2.3.4) and HOST B (10.6.7.8).  Here we show a little
complicated example.  From HOST A to HOST B, only old AH is used.
From HOST B to HOST A, new AH and new ESP are combined.
  
Now we should choose algorithm to be used corresponding to "AH"/"new
AH"/"ESP"/"new ESP".  Please refer to the "setkey" man page to know
algorithm names.  Our choice is MD5 for AH, new-HMAC-SHA1 for new AH,
and new-DES-expIV with 8 byte IV for new ESP.

Key length highly depends on each algorithm.  For example, key
length must be equal to 16 bytes for MD5, 20 for new-HMAC-SHA1,
and 8 for new-DES-expIV.  Now we choose "MYSECRETMYSECRET",
"KAMEKAMEKAMEKAMEKAME", "PASSWORD", respectively.

OK, let us assign SPI (Security Parameter Index) for each protocol.
Please note that we need 3 SPIs for this secure channel since three
security headers are produced (one for from HOST A to HOST B, two for
from HOST B to HOST A).  Please also note that SPI MUST be greater
than or equal to 256.  We choose, 1000, 2000, and 3000, respectively.


	         (1)
	HOST A ------> HOST B

	(1)PROTO=AH
		ALG=MD5(RFC1826)
		KEY=MYSECRETMYSECRET
		SPI=1000

	         (2.1)
	HOST A <------ HOST B
	       <------
	         (2.2) 

	(2.1)
	PROTO=AH
		ALG=new-HMAC-SHA1(new AH)
		KEY=KAMEKAMEKAMEKAMEKAME
		SPI=2000

	(2.2)
	PROTO=ESP
		ALG=new-DES-expIV(new ESP)
			IV length = 8
		KEY=PASSWORD
		SPI=3000

Now, let us setup security association.  Execute "setkey" on both HOST
A and B:

# setkey -c
add 10.2.3.4 10.6.7.8 ah  1000 -m transport -A keyed-md5 "MYSECRETMYSECRET" ;
add 10.6.7.8 10.2.3.4 ah  2000 -m transport -A hmac-sha1 "KAMEKAMEKAMEKAMEKAME" ;
add 10.6.7.8 10.2.3.4 esp 3000 -m transport -E des-cbc "PASSWORD" ;
^D

Actually, IPsec communication doesn't process until security policy
entries will be defined.  In this case, you must setup each host.

At A:
# setkey -c
spdadd 10.2.3.4 10.6.7.8 any -P out ipsec
	ah/transport/10.2.3.4-10.6.7.8/require ;
^D

At B:
spdadd 10.6.7.8 10.2.3.4 any -P out ipsec
	esp/transport//require
	ah/transport//require ;
^D

To utilize the security associations installed into the kernel, you
must set the socket security level by using setsockopt().
This is per-application (or per-socket) security.  For example,
the "ping" command has the -P option with parameter to enable AH and/or ESP.

For example:
% ping -P "out ipsec \
	ah/transport//use \
	esp/tunnel/10.0.1.1-10.0.1.2/require" 10.0.2.2

If there are proper SAs, this policy specification causes ICMP packet
to be AH transport mode inner ESP tunnel mode like below.

	   HOST C -----------> GATEWAY D ----------> HOST E
	  10.0.1.1        10.0.1.2   10.0.2.1       10.0.2.2
	    | |                 |                    |
	    | ======= ESP =======                    |
	    ==================== AH ==================


<<<EDNS0>>>

EDNS0 is defined in RFC2671.  With EDNS0, the resolver library can tell DNS
server of its receiving buffer size, and permit DNS server to transmit large
reply packet.  EDNS0 is necessary to take advantage of larger minimum MTU
in IPv6.  KAME libinet6 includes resolver side support for EDNS0.
Server side support for EDNS0 is included in ISC BIND9.

	query packet with EDNS0
	tells receive buffer size
KAME box -----------------------------> BIND9 DNS server
KAME box <----------------------------- BIND9 DNS server
	can transmit jumbo reply, since DNS server
	knows receive buffer size of KAME box

How to play with it:
- prepare KAME box and BIND9 DNS server (can be a same node)
- add the following into /etc/resolv.conf on KAME box:
	options edns0		<--- enables EDNS0
	nameserver <IPv4 or v6 address of BIND9 box>
- run applications compiled with libinet6 (like /usr/local/v6/bin/telnet),
  see EDNS0 packet fly on the wire by tcpdump or some other method.

Caveats:
- BIND 4/8 DNS server will choke with EDNS0 packet, so you must not
  turn the option on if you have BIND 4/8 DNS server.  If you enable
  "options edns0" against BIND 4/8 DNS server, you will never be able
  to resolve names.
- If you use IPv6 UDP as DNS transport, path MTU discovery may
  affect the traffic.  KAME box tries to fragment packet to 1280
  bytes, however, BIND9 may not.
- Some of our platforms do not use our extended resolver code in libinet6.
  See COVERAGE for detail.


<<Further readings>>

http://www.netbsd.org/Documentation/network/ipv6/
	Even if you are on non-netbsd operating system, the URL should be
	useful.
http://www.kame.net/

							<end of USAGE>
@


1.6.2.1
log
@file USAGE was added on branch RELENG_8_4 on 2013-03-28 13:03:42 +0000
@
text
@d1 529
@


1.6.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 529
	USAGE
	KAME Project
	$KAME: USAGE,v 1.33 2000/11/22 10:22:57 itojun Exp $
	$FreeBSD: releng/8.4/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $

This is an introduction of how to use the commands provided in the KAME
kit.  For more information, please refer to each man page.


<<<ifconfig>>>

A link-local address is automatically assigned to each interface, when
the interface becomes up for the first time.  Even if you find an interface
without a link-local address, do not panic.  The link-local address will be
assigned when it becomes up (with "ifconfig IF up").

If you do not see a link-local address assigned to an interface on "ifconfig
up", the interface does not support IPv6 for some reasons - for example,
if the interface does not support link-layer multicast (IFF_MULTICAST is not
set), the interface cannot be used for IPv6.

Some network drivers allow an interface to become up even without a
hardware address (for example, PCMCIA network cards).  In such cases, it is
possible that an interface has no link-local address even if the
interface is up.  If you see such situation, please disable the
interface once and then re-enable it (i.e. do `ifconfig IF down;
ifconfig IF up').

Pseudo interfaces (like "gif" tunnel device) will borrow IPv6
interface identifier (lowermost 64bit of the address) from
EUI64/IEEE802 sources, like ethernet cards.  Pseudo interfaces will be
able to get an IPv6 link-local address, if you have other "real"
interface configured beforehand.  If you have no EUI64/IEEE802 sources
on the node, we have last-resort code in the kernel, which generates
interface identifier from MD5(hostname).  MD5(hostname) may not be suitable
for your usage (for example, if you configure same hostname on both sides of
gif tunnel, you will be doomed), and if so, you may need to configure
link-local address manually.
See RFC2472 for more discussion on how to generate an interface ID for
pseudo interfaces.

If you have a router announcing Router Advertisement,
global addresses will be assigned automatically.  So, neither
"ifconfig" nor "prefix" is necessary for your *host* (non-router node).
(Please refer to "sysctl" section for configuring a host to accept
Router Advertisement.)

If you want to set up a router, you need to assign global addresses
for two or more interfaces by "ifconfig" or "prefix" (prefix command
is described at next section).
If you want to assign a global address by "ifconfig", don't forget to
specify the "alias" argument to keep the link-local address.

# ifconfig de0 inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 alias
# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active

See also "/etc/rc.network6" for actual examples.

<<prefix>>

In the IPv6 architecture, an IPv6 address of an interface can be
generated from a prefix assigned to the interface, and a
link-dependent identifier for the interface.  So assigning a full IPv6
address by ifconfig is not necessary anymore, because user can only
take care of prefix, by letting system take care of interface
identifier.

The newly added "prefix" command enables user to just assign prefixes
for interfaces, and let your system automatically generate IPv6
addresses.  Prefixes added by the "prefix" command is maintained in
the kernel consistently with prefixes assigned by Router
Advertisement (in case of hosts) and with prefixes assigned by Router
Renumbering (in case of routers).  Manual assignment of prefixes or
change of prefix properties take precedence over ones assigned by
Router Advertisement or Router Renumbering.

prefix command works only on routers.

If you want to assign a prefix (and consequently address) manually, do
as follows:

# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# prefix de0 3ffe:501:808:1::
# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active

To check assigned prefix, use the "ndp" command (See description of
ndp command about its usage).

# ndp -p
3ffe:501:808:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router

The "prefix" command also has node internal prefix renumbering
ability.

If you have multiple prefixes which have 3ffe:501:808:/48 at the top,
and would like to renumber them to 3ffe:501:4819:/48, then use the
"prefix" command with the "matchpr" argument and the "usepr" argument.

Suppose that current state of before renumbering as follows:

# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# ifconfig de1
de1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe55:7011%de1 prefixlen 64 scopeid 0x2
        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
        inet6 3ffe:501:808:2:200:f8ff:fe55:7011 prefixlen 64 
        ether 00:00:f8:55:70:11
        media: 100baseTX status: active
# ndp -p
3ffe:501:808:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router
3ffe:501:808:2::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router

Then do as follows:

# prefix -a matchpr 3ffe:501:808:: mp_len 48 usepr 3ffe:501:4819:: up_uselen 48 change

If command is successful, prefixes and addresses will be renumbered as
follows.

# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:4819:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# ifconfig de1
de1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe55:7011%de0 prefixlen 64 scopeid 0x2
        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
        inet6 3ffe:501:4819:2:200:f8ff:fe55:7011 prefixlen 64 
        ether 00:00:f8:55:70:11
        media: 100baseTX status: active
# ndp -p
3ffe:501:4819:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router
3ffe:501:4819:2::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
  No advertising router

See also "/etc/rc.network6" for actual examples.


<<<route>>>

If there is a router announcing Router Advertisement on a subnet,
you need not to add a default route for your host by hand
(Please refer to "sysctl" section to accept Router Advertisement).

If you want to add a default route manually, do like:

# route add -inet6 default fe80::200:a2ff:fe0e:7543%ed0

"default" means ::/0.  In other cases, if "prefixlen" is omitted, 64
is assumed for "prefixlen" to get along with the aggregatable address.

Note that, in IPv6, a link-local address should be used as gateway
("fe80::200:a2ff:fe0e:7543%ed0" in the above).  If you use global addresses,
ICMPv6 redirect will not work properly.  Also note that we use a special form
of link-local address as gateway.  See Section 1.3 of IMPLEMENTATION for
more details.
For ease of configuration we recommend you to avoid static routes and run
a routing daemon (route6d for example) instead.


<<<ping6>>>

Reachability can be checked by "ping6".  This "ping6" allows multicast
for its argument.

% ping6 -n -I ed0 ff02::1

PING6(56=40+8+8 bytes) fe80::5254:ff:feda:cb7d --> ff02::1%ed0
56 bytes from fe80::5254:ff:feda:cb7d%lo0, icmp_seq=0 hlim=64 time=0.25 ms
56 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0, icmp_seq=0 hlim=64 time=1.333 ms(DUP!)
56 bytes from fe80::5254:ff:feda:d161%ed0, icmp_seq=0 hlim=64 time=1.459 ms(DUP!)
56 bytes from fe80::260:97ff:fec2:80bf%ed0, icmp_seq=0 hlim=64 time=1.538 ms(DUP!)
56 bytes from 3ffe:501:4819:2000:5054:ff:fedb:aa46, icmp_seq=0 hlim=255 time=1.615 ms(DUP!)


<<<ping6 -w>>>

Name resolution is possible by ICMPv6 node information query message.
This is very convenient for link-local addresses whose host name cannot be
resolved by DNS.  Specify the "-w" option to "ping6".

% ping6 -n -I ed0 -w ff02::1

64 bytes from fe80::5254:ff:feda:cb7d%lo0: fto.kame.net
67 bytes from fe80::5254:ff:feda:d161%ed0: banana.kame.net
69 bytes from fe80::2a0:c9ff:fe84:ebd9%ed0: paradise.kame.net
66 bytes from fe80::260:8ff:fe8b:447f%ed0: taroh.kame.net
66 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0: ayame.kame.net
	

<<<traceroute6>>>

The route for a target host can be checked by "traceroute6".

% traceroute6 tokyo.v6.wide.ad.jp

traceroute to tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923), 30 hops max, 12 byte packets
 1  nr60.v6.kame.net  1.239 ms  0.924 ms  0.908 ms
 2  otemachi.v6.wide.ad.jp  28.953 ms  31.451 ms  26.567 ms
 3  tokyo.v6.wide.ad.jp  26.549 ms  26.58 ms  26.186 ms

If the -l option is specified, both address and name are shown in each line.
% traceroute6 -l tokyo.v6.wide.ad.jp

traceroute to tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923), 30 hops max, 12 byte packets
 1  nr60.v6.kame.net (3ffe:501:4819:2000:260:97ff:fec2:80bf)  1.23 ms  0.952 ms  0.92 ms
 2  otemachi.v6.wide.ad.jp (3ffe:501:0:1802:260:97ff:feb6:7ff0)  27.345 ms  26.706 ms  26.563 ms
 3  tokyo.v6.wide.ad.jp (3ffe:501:0:401:200:e8ff:fed5:8923)  26.329 ms  26.36 ms  28.63 ms


<<<ndp>>>

To display the current Neighbor cache, use "ndp":

% ndp -a
Neighbor                      Linklayer Address   Netif Expire    St Flgs Prbs
nr60.v6.kame.net              0:60:97:c2:80:bf      ed0  expired   S    R 
3ffe:501:4819:2000:2c0:cff:fe 0:c0:c:10:3a:53       ed0  permanent R      
paradise.v6.kame.net          52:54:0:dc:52:17      ed0  expired   S    R 
fe80::200:eff:fe49:f929%ed0   0:0:e:49:f9:29        ed0  expired   S    R 
fe80::200:86ff:fe05:80da%ed0  0:0:86:5:80:da        ed0  expired   S      
fe80::200:86ff:fe05:c2d8%ed0  0:0:86:5:c2:d8        ed0  9s        R      

To flush all of the NDP cache entries, execute the following as root.

# ndp -c

To display the prefix list:

% ndp -p
3ffe:501:4819:2000::/64 if=ed0
  flags=LA, vltime=2592000, pltime=604800, expire=29d23h59m58s, origin=RA
  advertised by
    fe80::5254:ff:fedc:5217%ed0 (reachable)
    fe80::260:97ff:fec2:80bf%ed0 (reachable)
    fe80::200:eff:fe49:f929%ed0 (no neighbor state)

To display the default router list:

% ndp -r
fe80::260:97ff:fec2:80bf if=ed0, flags=, expire=29m55s
fe80::5254:ff:fedc:5217 if=ed0, flags=, expire=29m7s
fe80::200:eff:fe49:f929 if=ed0, flags=, expire=28m47s


<<<rtsol>>>

To generate a Router Solicitation message right now to get global
addresses, use "rtsol".

# ifconfig ef0
ef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
        media 10baseT status active
        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
# rtsol ef0
# ifconfig ef0
ef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
        media 10baseT status active
        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
        inet6 3ffe:501:4819:2000:2a0:24ff:feab:839b prefixlen 64


<<<rtsold>>>

rtsold is a daemon version of rtsol.  If you run KAME IPv6 on a laptop
computer and frequently move with it, the daemon is useful since it watches
the interface and sends router solicitations when the status of the interface
changes.  Note, however, that the feature is disabled by default.  Please
add -m option when invocation of rtsold.

rtsold also supports multiple interfaces.  For example, you can
invoke the daemon as follows:

# rtsold -m ep0 cnw0


<<<netstat>>>

To see routing table:
	
# netstat -nr
# netstat -nrl
	long format with Ref and Use.  Note that bsdi4 does not support the
	-l option.  You should use the -O option instead.


<<<sysctl>>>

If "net.inet6.ip6.accept_rtadv" is 1, Router Advertisement is
accepted.  This means that global addresses and default route are
automatically set up.  Otherwise, the announcement is rejected.  The
default value is 0.  To set "net.inet6.ip6.accept_rtadv" to 1, execute
as follows:

# sysctl net.inet6.ip6.accept_rtadv=1


<<<gifconfig>>>

"gif" interface enables you to perform IPv{4,6} over IPv{4,6}
protocol tunneling.  To use this interface, you must specify the
outer IPv{4,6} address by using gifconfig, like:

# gifconfig gif0 163.221.198.61 163.221.11.21

"ifconfig gif0" will configure the address pair used for inner
IPv{4,6} header.

It is not required to configure inner IPv{4,6} address pair.  If
you do not configure inner IPv{4,6} address pair, tunnel link is
considered as un-numbered link and the source address of inner
IPv{4,6} address pair will be borrowed from other interfaces.

The following example configures un-numbered IPv6-over-IPv4 tunnel:
# gifconfig gif0 10.0.0.1 10.0.0.1 netmask 255.255.255.0

The following example configures numbered IPv6-over-IPv4 tunnel:
# gifconfig gif0 10.0.0.1 10.0.0.1 netmask 255.255.255.0
# ifconfig gif0 inet6 3ffe:501:808:5::1 3ffe:501:808:5::2 prefixlen 64 alias

IPv6 spec allows you to use point-to-point link without global IPv6
address assigned to the interface.  Routing protocol (such as RIPng)
uses link-local addresses only.  If you are to configure IPv6-over-IPv4
tunnel, you need not to configure an address pair for inner IPv6
header.  We suggest you to use the former example (un-numbered
IPv6-over-IPv4 tunnel) to connect to 6bone for simplicity.

Note that it is so easy to make an infinite routing loop using gif
interface, if you configure a tunnel using the same protocol family
for inner and outer header (i.e. IPv4-over-IPv4).

Refer to gifconfig(8) for more details.


<<<6to4>>>

WARNING: malicious party can abuse 6to4 relay routers/sites, read through
internet draft draft-itojun-ipv6-transition-abuse-xx.txt before configuring it.

"stf" interface enables you to perform 6to4 IPv6-over-IPv4 encapsulation,
as documented in draft-ietf-ngtrans-6to4-06.txt.  See stf(4) for details.


<<<inetd>>>

Inetd supports AF_INET and AF_INET6 sockets, with IPsec policy
configuration support.

Refer to inetd(8) for more details.


<<<IPsec>>>

IPsec requires fairly complex configuration, so here we show transport
mode only.  http://www.kame.net/newsletter/ has more comprehensive
examples.

Let us setup security association to deploy a secure channel between
HOST A (10.2.3.4) and HOST B (10.6.7.8).  Here we show a little
complicated example.  From HOST A to HOST B, only old AH is used.
From HOST B to HOST A, new AH and new ESP are combined.
  
Now we should choose algorithm to be used corresponding to "AH"/"new
AH"/"ESP"/"new ESP".  Please refer to the "setkey" man page to know
algorithm names.  Our choice is MD5 for AH, new-HMAC-SHA1 for new AH,
and new-DES-expIV with 8 byte IV for new ESP.

Key length highly depends on each algorithm.  For example, key
length must be equal to 16 bytes for MD5, 20 for new-HMAC-SHA1,
and 8 for new-DES-expIV.  Now we choose "MYSECRETMYSECRET",
"KAMEKAMEKAMEKAMEKAME", "PASSWORD", respectively.

OK, let us assign SPI (Security Parameter Index) for each protocol.
Please note that we need 3 SPIs for this secure channel since three
security headers are produced (one for from HOST A to HOST B, two for
from HOST B to HOST A).  Please also note that SPI MUST be greater
than or equal to 256.  We choose, 1000, 2000, and 3000, respectively.


	         (1)
	HOST A ------> HOST B

	(1)PROTO=AH
		ALG=MD5(RFC1826)
		KEY=MYSECRETMYSECRET
		SPI=1000

	         (2.1)
	HOST A <------ HOST B
	       <------
	         (2.2) 

	(2.1)
	PROTO=AH
		ALG=new-HMAC-SHA1(new AH)
		KEY=KAMEKAMEKAMEKAMEKAME
		SPI=2000

	(2.2)
	PROTO=ESP
		ALG=new-DES-expIV(new ESP)
			IV length = 8
		KEY=PASSWORD
		SPI=3000

Now, let us setup security association.  Execute "setkey" on both HOST
A and B:

# setkey -c
add 10.2.3.4 10.6.7.8 ah  1000 -m transport -A keyed-md5 "MYSECRETMYSECRET" ;
add 10.6.7.8 10.2.3.4 ah  2000 -m transport -A hmac-sha1 "KAMEKAMEKAMEKAMEKAME" ;
add 10.6.7.8 10.2.3.4 esp 3000 -m transport -E des-cbc "PASSWORD" ;
^D

Actually, IPsec communication doesn't process until security policy
entries will be defined.  In this case, you must setup each host.

At A:
# setkey -c
spdadd 10.2.3.4 10.6.7.8 any -P out ipsec
	ah/transport/10.2.3.4-10.6.7.8/require ;
^D

At B:
spdadd 10.6.7.8 10.2.3.4 any -P out ipsec
	esp/transport//require
	ah/transport//require ;
^D

To utilize the security associations installed into the kernel, you
must set the socket security level by using setsockopt().
This is per-application (or per-socket) security.  For example,
the "ping" command has the -P option with parameter to enable AH and/or ESP.

For example:
% ping -P "out ipsec \
	ah/transport//use \
	esp/tunnel/10.0.1.1-10.0.1.2/require" 10.0.2.2

If there are proper SAs, this policy specification causes ICMP packet
to be AH transport mode inner ESP tunnel mode like below.

	   HOST C -----------> GATEWAY D ----------> HOST E
	  10.0.1.1        10.0.1.2   10.0.2.1       10.0.2.2
	    | |                 |                    |
	    | ======= ESP =======                    |
	    ==================== AH ==================


<<<EDNS0>>>

EDNS0 is defined in RFC2671.  With EDNS0, the resolver library can tell DNS
server of its receiving buffer size, and permit DNS server to transmit large
reply packet.  EDNS0 is necessary to take advantage of larger minimum MTU
in IPv6.  KAME libinet6 includes resolver side support for EDNS0.
Server side support for EDNS0 is included in ISC BIND9.

	query packet with EDNS0
	tells receive buffer size
KAME box -----------------------------> BIND9 DNS server
KAME box <----------------------------- BIND9 DNS server
	can transmit jumbo reply, since DNS server
	knows receive buffer size of KAME box

How to play with it:
- prepare KAME box and BIND9 DNS server (can be a same node)
- add the following into /etc/resolv.conf on KAME box:
	options edns0		<--- enables EDNS0
	nameserver <IPv4 or v6 address of BIND9 box>
- run applications compiled with libinet6 (like /usr/local/v6/bin/telnet),
  see EDNS0 packet fly on the wire by tcpdump or some other method.

Caveats:
- BIND 4/8 DNS server will choke with EDNS0 packet, so you must not
  turn the option on if you have BIND 4/8 DNS server.  If you enable
  "options edns0" against BIND 4/8 DNS server, you will never be able
  to resolve names.
- If you use IPv6 UDP as DNS transport, path MTU discovery may
  affect the traffic.  KAME box tries to fragment packet to 1280
  bytes, however, BIND9 may not.
- Some of our platforms do not use our extended resolver code in libinet6.
  See COVERAGE for detail.


<<Further readings>>

http://www.netbsd.org/Documentation/network/ipv6/
	Even if you are on non-netbsd operating system, the URL should be
	useful.
http://www.kame.net/

							<end of USAGE>
@


1.5
log
@Fix some grammar nits.  Mainly the use of `a' or `an' where the opposite
is required.

PR:		33559
Submitted by:	Marc Olzheim <marcolz@@ilse.nl>
@
text
@d4 1
a4 1
	$FreeBSD$
@


1.5.22.1
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: stable/7/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.12.1
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: stable/6/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.40.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.5.40.2
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d4 1
a4 1
	$FreeBSD: stable/9/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.40.1.4.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.5.40.1.4.2
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: releng/9.1/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.40.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.5.40.1.2.2
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: releng/9.0/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.38.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.5.38.2
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: releng/7.4/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.36.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.5.34.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.5.34.2
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d4 1
a4 1
	$FreeBSD: stable/8/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.34.1.8.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.5.34.1.8.2
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: releng/8.3/share/examples/IPv6/USAGE 108106 2002-12-19 22:56:20Z trhodes $
@


1.5.34.1.6.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.5.34.1.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.5.34.1.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.5.32.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.5.30.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.5.28.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.4
log
@sysctl -w -> sysctl

Approved by:	ume
@
text
@d6 1
a6 1
This is a introduction of how to use the commands provided in the KAME
@


1.3
log
@Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
  - The definitions of SADB_* in sys/net/pfkeyv2.h are still different
    from RFC2407/IANA assignment because of binary compatibility
    issue.  It should be fixed under 5-CURRENT.
  - ip6po_m member of struct ip6_pktopts is no longer used.  But, it
    is still there because of binary compatibility issue.  It should
    be removed under 5-CURRENT.

Reviewed by:	itojun
Obtained from:	KAME
MFC after:	3 weeks
@
text
@d4 1
a4 1
	$FreeBSD: src/share/examples/IPv6/USAGE,v 1.2 2001/06/10 20:25:24 ume Exp $
d332 1
a332 1
# sysctl -w net.inet6.ip6.accept_rtadv=1
@


1.2
log
@Implement EDNS0 support, as EDNS0 support will be made mandatory for
IPv6 transport-ready resolvers/DNS servers.  Need careful configuration
when enable it. (default config is not affected).
See manpage for details.

XXX visible symbol __res_opt() is added, however, it is not supposed to be
called from outside, libc minor is not bumped.

Obtained from:	KAME/NetBSD
@
text
@d1 4
a4 5
			USAGE

			KAME Project
			http://www.kame.net/newsletter/
			$FreeBSD: src/share/examples/IPv6/USAGE,v 1.1 2000/02/26 19:44:12 shin Exp $
d9 1
d17 5
d29 12
a40 9
Pseudo interfaces (like "gif" tunnel device) will borrow IPv6 interface
identifier (lowermost 64bit of the address) from EUI64/IEEE802 sources,
like ethernet cards.  Pseudo interfaces will be able to get IPv6 link-local
address, if you have other "real" interface configured beforehand.
If you have no EUI64/IEEE802 sources on the node, you may need to configure
link-local address manually.  Though we have last-resort code in the kernel,
which generates interface identifier from MD5(hostname), it may not suitable
for your usage (for example, if you configure same hostname on both sides
of gif tunnel, you will be doomed).
d43 4
a46 3
global addresses will be assigned automatically.  So, "ifconfig" is not
necessary for your *host*. (Please refer to "sysctl" section for configuring
a host to accept Router Advertisement.)
d49 2
a50 2
for two or more interfaces by "ifconfig" or "prefix". (prefix command
is described at next section)
d54 1
a54 1
# ifconfig de0 inet6 fec0:0:0:1000:200:f8ff:fe01:6317 alias
d57 5
a61 7
        inet 172.16.202.12 netmask 0xffffff00 broadcast 172.16.202.255
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64
        inet6 fec0:0:0:1000:200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:1000:: prefixlen 64 anycast
        ether 00:00:f8:01:63:17
        media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP
d67 6
a72 5
In IPv6 architecture, an IPv6 address of an interface can be generated
from a prefix assigned to it, and a link-dependent identifier for the
interface.  Assigning a full IPv6 address by ifconfig is not
necessary anymore, because, user can only take care of prefix, by letting
system take care of interface identifier.
d78 4
a81 1
Renumbering(in case of routers).
d83 1
a83 6
But "prefix" command can only be used on router, because host should be
able to configure its addr automatically. Prefixes added by the "prefix"
command are maintained independently from prefixes assigned by
Router Advertisement. Those two type of prefixes should not coexist on
a machine at the same time, and when it happens, it is considered to be
miss configuration.
d85 1
a85 4
Manual assignment of prefixes or change of prefix properties take
precedence over ones assigned by Router Renumbering.

If you want to assign a prefix(and consequently an address) manually, do
a87 1
# prefix de0 fec0:0:0:1000::
d90 12
a101 7
        inet 172.16.202.12 netmask 0xffffff00 broadcast 172.16.202.255
        inet6 fe80:1::200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:1000:200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:1000:: prefixlen 64 anycast
        ether 00:00:f8:01:63:17
        media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP
d103 2
a104 2
To check assigned prefix, use the "ndp" command. (See description of
ndp command about its usage)
d107 2
a108 2
fec0:0:0:1000::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never
d114 2
a115 2
If you have multiple prefixes which have fec0:0:0:1000:/56 at the top,
and would like to renumber them to fec0:0:0:2000:/56, then use the
d122 5
a126 8
        inet 172.16.202.12 netmask 0xffffff00 broadcast 172.16.202.255
        inet6 fe80:1::200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:1000:200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:1000:: prefixlen 64 anycast
        ether 00:00:f8:01:63:17
        media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP

d129 3
a131 4
        inet 172.16.203.12 netmask 0xffffff00 broadcast 172.16.203.255
        inet6 fe80:1::200:f8ff:fe55:7011 prefixlen 64
        inet6 fec0:0:0:1001:200:f8ff:fe55:7011 prefixlen 64
        inet6 fec0:0:0:1001:: prefixlen 64 anycast
d133 1
a133 3
        media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP

d135 2
a136 2
fec0:0:0:1000::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never
d138 2
a139 2
fec0:0:0:1001::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never
d144 1
a144 1
# prefix -a matchpr fec0:0:0:1000:: mp_len 56 usepr fec0:0:0:2000:: up_uselen 56 change
d151 5
a155 7
        inet 172.16.202.12 netmask 0xffffff00 broadcast 172.16.202.255
        inet6 fe80:1::200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:2000:200:f8ff:fe01:6317 prefixlen 64
        inet6 fec0:0:0:2000:: prefixlen 64 anycast
        ether 00:00:f8:01:63:17
        media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP
d158 3
a160 4
        inet 172.16.203.12 netmask 0xffffff00 broadcast 172.16.203.255
        inet6 fe80:1::200:f8ff:fe55:7011 prefixlen 64
        inet6 fec0:0:0:2001:200:f8ff:fe55:7011 prefixlen 64
        inet6 fec0:0:0:2001:: prefixlen 64 anycast
d162 1
a162 2
        media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP
d164 2
a165 2
fec0:0:0:2000::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never
d167 2
a168 2
fec0:0:0:2001::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never
d173 1
d176 3
a178 3
If there is a router announcing Router Advertisement on the subnet,
you don't need to add a default route for your host by yourself.
(Please refer to "sysctl" section to accept Router Advertisement.)
d180 1
a180 1
If you want to add a default route manually, do as follows:
d182 1
a182 1
# route add -inet6 default fe80::200:a2ff:fe0e:7543%de0
d184 2
a185 1
"default" means ::/0.
d187 7
a193 5
Note that, in IPv6, link-local address should be used as gateway
("fe80::200:a2ff:fe0e:7543%de1" in the above).  If you use global addresses,
icmp6 redirect may not work properly.  For ease of configuration we recommend
you to avoid static routes and run a routing daemon (route6d for example)
instead.
d195 2
a196 1
<<<ping6>>> (This might be integrated into "ping" as "ping -6" in the future.)
d201 9
a209 9
% ping6 -I xl0 ff02::1
or
% ping6 ff02::1%xl0

PING6(56=40+8+8 bytes) fe80::5254:ff:feda:cb7d --> ff02::1
56 bytes from fe80::5254:ff:feda:cb7d, icmp_seq=0 hlim=64 time=0.25 ms
56 bytes from fe80::2a0:c9ff:fe84:ed6c, icmp_seq=0 hlim=64 time=1.333 ms(DUP!)
56 bytes from fe80::5254:ff:feda:d161, icmp_seq=0 hlim=64 time=1.459 ms(DUP!)
56 bytes from fe80::260:97ff:fec2:80bf, icmp_seq=0 hlim=64 time=1.538 ms(DUP!)
d217 1
a217 1
% ping6 -I xl0 -w ff02::1
d219 6
a224 5
64 bytes from fe80::5254:ff:feda:cb7d: fto.kame.net
67 bytes from fe80::5254:ff:feda:d161: banana.kame.net
69 bytes from fe80::2a0:c9ff:fe84:ebd9: paradise.kame.net
66 bytes from fe80::260:8ff:fe8b:447f: taroh.kame.net
66 bytes from fe80::2a0:c9ff:fe84:ed6c: ayame.kame.net
d245 1
d252 6
a257 6
nr60.v6.kame.net              0:60:97:c2:80:bf      xl0  expired   S    R
fec0:0:0:1000:2c0:cff:fe10    0:c0:c:10:3a:53       xl0  permanent R
paradise.v6.kame.net          52:54:0:dc:52:17      xl0  expired   S    R
fe80:1::200:eff:fe49:f929     0:0:e:49:f9:29        xl0  expired   S    R
fe80:1::200:86ff:fe05:80da    0:0:86:5:80:da        xl0  expired   S
fe80:1::200:86ff:fe05:c2d8    0:0:86:5:c2:d8        xl0  9s        R
d259 1
a259 1
To flush the all NDP cache, execute the following by root.
d263 1
a263 1
To display the prefix list.
d266 2
a267 2
fec0:0:0::1000::/64 if=xl0
  flags=LA, vltime=2592000, pltime=604800, expire=29d23h59m58s
d269 3
a271 3
    fe80::5254:ff:fedc:5217
    fe80::260:97ff:fec2:80bf
    fe80::200:eff:fe49:f929
d273 1
a273 1
To display the default router list.
d276 4
a279 3
fe80::260:97ff:fec2:80bf if=xl0, flags=, expire=29m55s
fe80::5254:ff:fedc:5217 if=xl0, flags=, expire=29m7s
fe80::200:eff:fe49:f929 if=xl0, flags=, expire=28m47s
d286 12
a297 15
# ifconfig xl0
xl0: flags=8a43<UP,BROADCAST,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80:2::2a0:24ff:feab:839b%xl0 prefixlen 64
        ether 0:a0:24:ab:83:9b
	media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP 100baseTX <hw-loopback>

# rtsol xl0
# ifconfig xl0
xl0: flags=8a43<UP,BROADCAST,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80:2::2a0:24ff:feab:839b%xl0 prefixlen 64
        inet6 fec0:0:0:1000:2a0:24ff:feab:839b prefixlen 64
        ether 0:a0:24:ab:83:9b
	media: autoselect (10baseT/UTP) status: active
	supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UTP <full-duplex> 10baseT/UTP 100baseTX <hw-loopback>
d306 1
a306 1
add -m option at invocation of rtsold.
d310 1
d313 1
d317 5
a322 2
# netstat -nr
# netstat -nrl (long format with Ref and Use)
d334 1
d341 1
a341 1
# gifconfig gif0 172.16.198.61 172.16.11.21
d356 1
a356 1
# ifconfig gif0 inet6 fec0:0:0:3000::1 fec0:0:0:3000::2 prefixlen 64 alias
d363 1
a363 2
IPv6-over-IPv4 tunnel) to connect to 6bone for simplicity,
for router to router connection.
d371 10
d388 1
d391 3
a393 3
The current KAME supports both transport mode and tunnel mode.
However, tunnel mode comes with some restrictions.
http://www.kame.net/newsletter/ has more comprehensive examples.
d395 1
a395 1
Let's setup security association to deploy a secure channel between
d399 1
a399 1

d410 1
a410 1
OK, let's assign SPI (Security Parameter Index) for each protocol.
d428 1
a428 1
	         (2.2)
d443 1
a443 1
Now, let's setup security association.  Execute "setkey" on both HOST
d463 2
a464 3
	esp/transport/10.6.7.8-10.2.3.4/require ;
spdadd 10.6.7.8 10.2.3.4 any -P out ipsec
	ah/transport/10.6.7.8-10.2.3.4/require ;
d474 1
a474 1
	ah/transport/10.0.1.1-10.0.2.2/use \
a486 159

Another example using IPv6.

ESP transport mode is recommended for TCP port number 110 between Host-A and
Host-B.

              ============ ESP ============
              |                           |
           Host-A                        Host-B
          fec0::10 -------------------- fec0::11

Encryption algorithm is blowfish-cbc whose key is "kamekame", and
authentication algorithm is hmac-sha1 whose key is "this is the test key".
Configuration at Host-A:

        # setkey -c <<EOF
        spdadd fec0::10[any] fec0::11[110] tcp -P out ipsec
                esp/transport/fec0::10-fec0::11/use ;
        spdadd fec0::11[110] fec0::10[any] tcp -P in ipsec
                esp/transport/fec0::11-fec0::10/use ;
        add fec0::10 fec0::11 esp 0x10001
                -m transport
                -E blowfish-cbc "kamekame"
                -A hmac-sha1 "this is the test key" ;
        add fec0::11 fec0::10 esp 0x10002
                -m transport
                -E blowfish-cbc "kamekame"
                -A hmac-sha1 "this is the test key" ;
        EOF

and at Host-B:

        # setkey -c <<EOF
        spdadd fec0::11[110] fec0::10[any] tcp -P out ipsec
                esp/transport/fec0::11-fec0::10/use ;
        spdadd fec0::10[any] fec0::11[110] tcp -P in ipsec
                esp/transport/fec0::10-fec0::11/use ;
        add fec0::10 fec0::11 esp 0x10001 -m transport
                -E blowfish-cbc "kamekame"
                -A hmac-sha1 "this is the test key" ;
        add fec0::11 fec0::10 esp 0x10002 -m transport
                -E blowfish-cbc "kamekame"
                -A hmac-sha1 "this is the test key" ;
        EOF

Note the direction of SP.


Tunnel mode between two security gateways

Security protocol is old AH tunnel mode, i.e. specified by RFC1826, with
keyed-md5 whose key is "this is the test" as authentication algorithm.

                               ======= AH =======
                               |                |
           Network-A       Gateway-A        Gateway-B        Network-B
          10.0.1.0/24 ---- 172.16.0.1 ----- 172.16.0.2 ---- 10.0.2.0/24

Configuration at Gateway-A:

        # setkey -c <<EOF
        spdadd 10.0.1.0/24 10.0.2.0/24 any -P out ipsec
                ah/tunnel/172.16.0.1-172.16.0.2/require ;
        spdadd 10.0.2.0/24 10.0.1.0/24 any -P in ipsec
                ah/tunnel/172.16.0.2-172.16.0.1/require ;
        add 172.16.0.1 172.16.0.2 ah-old 0x10003 -m any
                -A keyed-md5 "this is the test" ;
        add 172.16.0.2 172.16.0.1 ah-old 0x10004 -m any
                -A keyed-md5 "this is the test" ;

If port number field is omitted such above then "[any]" is employed. `-m'
specifies the mode of SA to be used. "-m any" means wild-card of mode of
security protocol. You can use this SA for both tunnel and transport mode.

and at Gateway-B:

        # setkey -c <<EOF
        spdadd 10.0.2.0/24 10.0.1.0/24 any -P out ipsec
                ah/tunnel/172.16.0.2-172.16.0.1/require ;
        spdadd 10.0.1.0/24 10.0.2.0/24 any -P in ipsec
                ah/tunnel/172.16.0.1-172.16.0.2/require ;
        add 172.16.0.1 172.16.0.2 ah-old 0x10003 -m any
                -A keyed-md5 "this is the test" ;
        add 172.16.0.2 172.16.0.1 ah-old 0x10004 -m any
                -A keyed-md5 "this is the test" ;


Making SA bundle between two security gateways

AH transport mode and ESP tunnel mode is required between Gateway-A and
Gateway-B. In this case, ESP tunnel mode is applied first, and AH transport
mode is next.

                                  ========== AH =========
                                  |  ======= ESP =====  |
                                  |  |               |  |
             Network-A          Gateway-A        Gateway-B           Network-B
          fec0:0:0:1::/64 --- fec0:0:0:1::1 ---- fec0:0:0:2::1 --- fec0:0:0:2::/64

Encryption algorithm is 3des-cbc, and authentication algorithm for ESP is
hmac-sha1. Authentication algorithm for AH is hmac-md5.
Configuration at Gateway-A:

        # setkey -c <<EOF
        spdadd fec0:0:0:1::/64 fec0:0:0:2::/64 any -P out ipsec
                esp/tunnel/fec0:0:0:1::1-fec0:0:0:2::1/require
                ah/transport/fec0:0:0:1::1-fec0:0:0:2::1/require ;
        spdadd fec0:0:0:2::/64 fec0:0:0:1::/64 any -P in ipsec
                esp/tunnel/fec0:0:0:2::1-fec0:0:0:1::1/require
                ah/transport/fec0:0:0:2::1-fec0:0:0:1::1/require ;
        add fec0:0:0:1::1 fec0:0:0:2::1 esp 0x10001 -m tunnel
                -E 3des-cbc "kamekame12341234kame1234"
                -A hmac-sha1 "this is the test key" ;
        add fec0:0:0:1::1 fec0:0:0:2::1 ah 0x10001 -m transport
                -A hmac-md5 "this is the test" ;
        add fec0:0:0:2::1 fec0:0:0:1::1 esp 0x10001 -m tunnel
                -E 3des-cbc "kamekame12341234kame1234"
                -A hmac-sha1 "this is the test key" ;
        add fec0:0:0:2::1 fec0:0:0:1::1 ah 0x10001 -m transport
                -A hmac-md5 "this is the test" ;


Making SAs with the different end

ESP tunnel mode is required between Host-A and Gateway-A. Encryption
algorithm is cast128-cbc, and authentication algorithm for ESP is hmac-sha1.
ESP transport mode is recommended between Host-A and Host-B. Encryption
algorithm is rc5-cbc, and authentication algorithm for ESP is hmac-md5.

              ================== ESP =================
              |  ======= ESP =======                 |
              |  |                 |                 |
             Host-A            Gateway-A           Host-B
          fec0:0:0:1::1 ---- fec0:0:0:2::1 ---- fec0:0:0:2::2

Configuration at Host-A:

        # setkey -c <<EOF
        spdadd fec0:0:0:1::1[any] fec0:0:0:2::2[80] tcp -P out ipsec
                esp/transport/fec0:0:0:1::1-fec0:0:0:2::2/use
                esp/tunnel/fec0:0:0:1::1-fec0:0:0:2::1/require ;
        spdadd fec0:0:0:2::1[80] fec0:0:0:1::1[any] tcp -P in ipsec
                esp/transport/fec0:0:0:2::2-fec0:0:0:l::1/use
                esp/tunnel/fec0:0:0:2::1-fec0:0:0:1::1/require ;
        add fec0:0:0:1::1 fec0:0:0:2::2 esp 0x10001
                -m transport
                -E cast128-cbc "12341234"
                -A hmac-sha1 "this is the test key" ;
        add fec0:0:0:1::1 fec0:0:0:2::1 esp 0x10002
                -E rc5-cbc "kamekame"
                -A hmac-md5 "this is the test" ;
        add fec0:0:0:2::2 fec0:0:0:1::1 esp 0x10003
                -m transport
                -E cast128-cbc "12341234"
                -A hmac-sha1 "this is the test key" ;
        add fec0:0:0:2::1 fec0:0:0:1::1 esp 0x10004
                -E rc5-cbc "kamekame"
                -A hmac-md5 "this is the test" ;

d520 8
@


1.1
log
@Add IPv6 related docs.

Reviewed by: phantom
@
text
@d5 1
a5 1
			$FreeBSD$
d628 34
@


1.1.2.1
log
@MFC: Implement EDNS0 support, as EDNS0 support will be made mandatory for
IPv6 transport-ready resolvers/DNS servers.  Need careful configuration
when enable it. (default config is not affected).
See manpage for details.

  XXX visible symbol __res_opt() is added, however, it is not supposed to be
  called from outside, libc minor is not bumped.

	src/include/resolv.h:			1.19->1.20
	src/include/arpa/nameser.h:		1.14->1.15
	src/include/arpa/nameser_compat.h:	1.2->1.3
	src/lib/libc/net/getaddrinfo.c:		1.20->1.21
	src/lib/libc/net/res_debug.c:		1.18->1.19
	src/lib/libc/net/res_init.c:		1.23->1.24
	src/lib/libc/net/res_mkquery.c:		1.15->1.16
	src/lib/libc/net/res_query.c:		1.19->1.20
	src/lib/libc/net/resolver.3:		1.14->1.15
	src/share/examples/IPv6/USAGE:		1.1->1.2
@
text
@d5 1
a5 1
			$FreeBSD: src/share/examples/IPv6/USAGE,v 1.1 2000/02/26 19:44:12 shin Exp $
a627 34

<<<EDNS0>>>

EDNS0 is defined in RFC2671.  With EDNS0, the resolver library can tell DNS
server of its receiving buffer size, and permit DNS server to transmit large
reply packet.  EDNS0 is necessary to take advantage of larger minimum MTU
in IPv6.  KAME libinet6 includes resolver side support for EDNS0.
Server side support for EDNS0 is included in ISC BIND9.

	query packet with EDNS0
	tells receive buffer size
KAME box -----------------------------> BIND9 DNS server
KAME box <----------------------------- BIND9 DNS server
	can transmit jumbo reply, since DNS server
	knows receive buffer size of KAME box

How to play with it:
- prepare KAME box and BIND9 DNS server (can be a same node)
- add the following into /etc/resolv.conf on KAME box:
	options edns0		<--- enables EDNS0
	nameserver <IPv4 or v6 address of BIND9 box>
- run applications compiled with libinet6 (like /usr/local/v6/bin/telnet),
  see EDNS0 packet fly on the wire by tcpdump or some other method.

Caveats:
- BIND 4/8 DNS server will choke with EDNS0 packet, so you must not
  turn the option on if you have BIND 4/8 DNS server.  If you enable
  "options edns0" against BIND 4/8 DNS server, you will never be able
  to resolve names.
- If you use IPv6 UDP as DNS transport, path MTU discovery may
  affect the traffic.  KAME box tries to fragment packet to 1280
  bytes, however, BIND9 may not.
- Some of our platforms do not use our extended resolver code in libinet6.
  See COVERAGE for detail.
@


1.1.2.2
log
@MFC: Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

	etc/defaults/rc.conf:			1.111
	etc/rc.network:				1.98
	etc/rc.network6:			1.20
	lib/libipsec/ipsec_set_policy.3:	1.8
	lib/libipsec/ipsec_strerror.3:		1.7
	lib/libipsec/ipsec_strerror.c:		1.3
	lib/libipsec/ipsec_strerror.h:		1.3
	lib/libipsec/libpfkey.h:		1.2
	lib/libipsec/pfkey.c:			1.3
	lib/libipsec/pfkey_dump.c:		1.3
	lib/libipsec/policy_token.l:		1.5
	lib/libipsec/test-policy.c:		1.4
	sbin/ifconfig/ifconfig.8:		1.42
	sbin/ifconfig/ifconfig.c:		1.63
	sbin/ping6/ping6.8:			1.10
	sbin/ping6/ping6.c:			1.9
	sbin/route/route.c:			1.48, 1.50
	sbin/rtsol/Makefile:			1.4
	share/doc/IPv6/IMPLEMENTATION:		1.3
	share/examples/IPv6/USAGE:		1.3
	share/man/man4/faith.4:			1.10
	share/man/man4/gif.4:			1.9
	share/man/man4/inet6.4:			1.8
	share/man/man4/ip6.4:			1.8
	share/man/man4/ipsec.4:			1.9
	share/man/man4/kame.4:			1.8
	share/man/man4/stf.4:			1.8
	sys/conf/files:				1.534
	sys/crypto/md5.c:			1.4
	sys/crypto/sha1.c:			1.7
	sys/crypto/blowfish/bf_enc.c:		1.4
	sys/crypto/blowfish/bf_locl.h:		1.4
	sys/crypto/blowfish/bf_skey.c:		1.4
	sys/crypto/blowfish/blowfish.h:		1.4
	sys/crypto/cast128/cast128.c:		1.4
	sys/crypto/cast128/cast128.h:		1.4
	sys/crypto/des/des.h:			1.4
	sys/crypto/des/des_ecb.c:		1.4
	sys/crypto/des/des_locl.h:		1.5
	sys/crypto/des/des_setkey.c:		1.4
	sys/crypto/rijndael/boxes-fst.dat:	1.2
	sys/crypto/rijndael/rijndael-alg-fst.c:	1.2, 1.3
	sys/crypto/rijndael/rijndael-alg-fst.h:	1.2
	sys/crypto/rijndael/rijndael-api-fst.c:	1.2
	sys/crypto/rijndael/rijndael-api-fst.h:	1.2
	sys/crypto/rijndael/rijndael_local.h:	1.3
	sys/kern/uipc_domain.c:			1.24
	sys/kern/uipc_mbuf.c:			1.82
	sys/kern/uipc_mbuf2.c:			1.8
	sys/net/if.c:				1.109
	sys/net/if_faith.c:			1.4, 1.5
	sys/net/if_gif.c:			1.10
	sys/net/if_gif.h:			1.4
	sys/net/if_loop.c:			1.61
	sys/net/if_sppp.h:			1.17
	sys/net/if_spppsubr.c:			1.68, 1.69
	sys/net/net_osdep.c:			1.4
	sys/net/net_osdep.h:			1.5
	sys/net/pfkeyv2.h:			1.6
	sys/net/ppp_defs.h:			1.7
	sys/net/rtsock.c:			1.52
	sys/netinet/icmp6.h:			1.4
	sys/netinet/in.c:			1.54
	sys/netinet/in_gif.c:			1.10
	sys/netinet/in_pcb.c:			1.84
	sys/netinet/in_pcb.h:			1.38
	sys/netinet/in_proto.c:			1.56
	sys/netinet/ip6.h:			1.5
	sys/netinet/ip_ecn.c:			1.4
	sys/netinet/ip_ecn.h:			1.4
	sys/netinet/ip_encap.c:			1.4
	sys/netinet/ip_icmp.c:			1.57
	sys/netinet/ip_input.c:			1.171
	sys/netinet/ip_output.c:		1.126
	sys/netinet/ip_var.h:			1.56
	sys/netinet/raw_ip.c:			1.78
	sys/netinet/tcp_input.c:		1.132
	sys/netinet/tcp_output.c:		1.50
	sys/netinet/tcp_subr.c:			1.103
	sys/netinet/tcp_usrreq.c:		1.60
	sys/netinet/udp_usrreq.c:		1.89
	sys/netinet6/ah.h:			1.5
	sys/netinet6/ah6.h:			1.4
	sys/netinet6/ah_core.c:			1.8
	sys/netinet6/ah_input.c:		1.7
	sys/netinet6/ah_output.c:		1.7
	sys/netinet6/dest6.c:			1.6
	sys/netinet6/esp.h:			1.4
	sys/netinet6/esp6.h:			1.4
	sys/netinet6/esp_core.c:		1.5
	sys/netinet6/esp_input.c:		1.7
	sys/netinet6/esp_output.c:		1.5
	sys/netinet6/frag6.c:			1.8
	sys/netinet6/icmp6.c:			1.11
	sys/netinet6/in6.c:			1.12
	sys/netinet6/in6.h:			1.13
	sys/netinet6/in6_cksum.c:		1.4
	sys/netinet6/in6_gif.c:			1.5
	sys/netinet6/in6_ifattach.c:		1.6
	sys/netinet6/in6_ifattach.h:		1.3
	sys/netinet6/in6_pcb.c:			1.15
	sys/netinet6/in6_pcb.h:			1.4
	sys/netinet6/in6_prefix.c:		1.7
	sys/netinet6/in6_prefix.h:		1.5
	sys/netinet6/in6_proto.c:		1.14
	sys/netinet6/in6_rmx.c:			1.4
	sys/netinet6/in6_src.c:			1.4
	sys/netinet6/in6_var.h:			1.8
	sys/netinet6/ip6_ecn.h:			1.4
	sys/netinet6/ip6_forward.c:		1.11
	sys/netinet6/ip6_fw.c:			1.11
	sys/netinet6/ip6_fw.h:			1.11
	sys/netinet6/ip6_input.c:		1.27
	sys/netinet6/ip6_mroute.c:		1.7
	sys/netinet6/ip6_mroute.h:		1.4
	sys/netinet6/ip6_output.c:		1.25
	sys/netinet6/ip6_var.h:			1.7
	sys/netinet6/ip6protosw.h:		1.6
	sys/netinet6/ipcomp.h:			1.2
	sys/netinet6/ipcomp6.h:			1.2
	sys/netinet6/ipcomp_core.c:		1.2
	sys/netinet6/ipcomp_input.c:		1.2
	sys/netinet6/ipcomp_output.c:		1.2
	sys/netinet6/ipsec.c:			1.12
	sys/netinet6/ipsec.h:			1.8
	sys/netinet6/ipsec6.h:			1.5
	sys/netinet6/mld6.c:			1.7
	sys/netinet6/nd6.c:			1.9
	sys/netinet6/nd6.h:			1.7
	sys/netinet6/nd6_nbr.c:			1.9
	sys/netinet6/nd6_rtr.c:			1.7, 1.8
	sys/netinet6/raw_ip6.c:			1.11
	sys/netinet6/route6.c:			1.4
	sys/netinet6/scope6.c:			1.2
	sys/netinet6/udp6_output.c:		1.3
	sys/netinet6/udp6_usrreq.c:		1.15
	sys/netkey/key.c:			1.25
	sys/netkey/key.h:			1.7
	sys/netkey/key_debug.c:			1.14
	sys/netkey/key_debug.h:			1.7
	sys/netkey/key_var.h:			1.4
	sys/netkey/keydb.h:			1.6
	sys/netkey/keysock.c:			1.6
	sys/netsmb/smb_crypt.c:			1.2
	sys/sys/mbuf.h:				1.79, 1.80
	sys/sys/protosw.h:			1.33
	sys/sys/socket.h:			1.54, 1.56
	sys/sys/sockio.h:			1.17
	usr.bin/netstat/inet.c:			1.42
	usr.bin/netstat/inet6.c:		1.10
	usr.bin/netstat/ipsec.c:		1.2
	usr.bin/netstat/main.c:			1.40
	usr.bin/netstat/mroute6.c:		1.5
	usr.bin/netstat/netstat.1:		1.29
	usr.bin/netstat/netstat.h:		1.21
	usr.bin/netstat/route.c:		1.50, 1.51, 1.55
	usr.sbin/faithd/Makefile:		1.6
	usr.sbin/faithd/README:			1.4
	usr.sbin/faithd/faithd.8:		1.9
	usr.sbin/faithd/faithd.c:		1.7
	usr.sbin/faithd/faithd.h:		1.3
	usr.sbin/faithd/ftp.c:			1.5
	usr.sbin/faithd/rsh.c:			1.5
	usr.sbin/faithd/tcp.c:			1.3
	usr.sbin/gifconfig/gifconfig.8:		1.6
	usr.sbin/gifconfig/gifconfig.c:		1.4
	usr.sbin/ifmcstat/ifmcstat.8:		1.3
	usr.sbin/ifmcstat/ifmcstat.c:		1.7
	usr.sbin/mld6query/mld6.c:		1.2
	usr.sbin/mld6query/mld6query.8:		1.2
	usr.sbin/ndp/ndp.8:			1.6
	usr.sbin/ndp/ndp.c:			1.6
	usr.sbin/prefix/Makefile:		1.4
	usr.sbin/rip6query/rip6query.8:		1.4
	usr.sbin/rip6query/rip6query.c:		1.5
	usr.sbin/route6d/route6d.8:		1.6
	usr.sbin/route6d/route6d.c:		1.9
	usr.sbin/route6d/route6d.h:		1.3
	usr.sbin/rrenumd/lexer.l:		1.3
	usr.sbin/rrenumd/parser.y:		1.3
	usr.sbin/rrenumd/rrenumd.8:		1.6
	usr.sbin/rrenumd/rrenumd.c:		1.4
	usr.sbin/rrenumd/rrenumd.conf.5:	1.10
	usr.sbin/rrenumd/rrenumd.h:		1.3
	usr.sbin/rtadvd/advcap.c:		1.4
	usr.sbin/rtadvd/advcap.h:		1.4
	usr.sbin/rtadvd/config.c:		1.7
	usr.sbin/rtadvd/config.h:		1.4
	usr.sbin/rtadvd/dump.c:			1.3
	usr.sbin/rtadvd/dump.h:			1.3
	usr.sbin/rtadvd/if.c:			1.6
	usr.sbin/rtadvd/if.h:			1.4
	usr.sbin/rtadvd/pathnames.h:		1.5
	usr.sbin/rtadvd/rrenum.c:		1.5
	usr.sbin/rtadvd/rrenum.h:		1.4
	usr.sbin/rtadvd/rtadvd.8:		1.8
	usr.sbin/rtadvd/rtadvd.c:		1.6
	usr.sbin/rtadvd/rtadvd.conf.5:		1.6
	usr.sbin/rtadvd/rtadvd.h:		1.4
	usr.sbin/rtadvd/timer.c:		1.4
	usr.sbin/rtadvd/timer.h:		1.4
	usr.sbin/rtsold/Makefile:		1.6
	usr.sbin/rtsold/dump.c:			1.4
	usr.sbin/rtsold/if.c:			1.5
	usr.sbin/rtsold/probe.c:		1.5
	usr.sbin/rtsold/rtsol.c:		1.4
	usr.sbin/rtsold/rtsold.8:		1.5
	usr.sbin/rtsold/rtsold.c:		1.4
	usr.sbin/rtsold/rtsold.h:		1.4
	usr.sbin/setkey/parse.y:		1.3
	usr.sbin/setkey/scriptdump.pl:		1.3
	usr.sbin/setkey/setkey.8:		1.14
	usr.sbin/setkey/setkey.c:		1.3
	usr.sbin/setkey/token.l:		1.5
	usr.sbin/traceroute6/traceroute6.8:	1.7
	usr.sbin/traceroute6/traceroute6.c:	1.8
@
text
@d1 5
a5 4
	USAGE
	KAME Project
	$KAME: USAGE,v 1.33 2000/11/22 10:22:57 itojun Exp $
	$FreeBSD: src/share/examples/IPv6/USAGE,v 1.1 2000/02/26 19:44:12 shin Exp $
a9 1

a16 5
If you do not see a link-local address assigned to an interface on "ifconfig
up", the interface does not support IPv6 for some reasons - for example,
if the interface does not support link-layer multicast (IFF_MULTICAST is not
set), the interface cannot be used for IPv6.

d24 9
a32 12
Pseudo interfaces (like "gif" tunnel device) will borrow IPv6
interface identifier (lowermost 64bit of the address) from
EUI64/IEEE802 sources, like ethernet cards.  Pseudo interfaces will be
able to get an IPv6 link-local address, if you have other "real"
interface configured beforehand.  If you have no EUI64/IEEE802 sources
on the node, we have last-resort code in the kernel, which generates
interface identifier from MD5(hostname).  MD5(hostname) may not be suitable
for your usage (for example, if you configure same hostname on both sides of
gif tunnel, you will be doomed), and if so, you may need to configure
link-local address manually.
See RFC2472 for more discussion on how to generate an interface ID for
pseudo interfaces.
d35 3
a37 4
global addresses will be assigned automatically.  So, neither
"ifconfig" nor "prefix" is necessary for your *host* (non-router node).
(Please refer to "sysctl" section for configuring a host to accept
Router Advertisement.)
d40 2
a41 2
for two or more interfaces by "ifconfig" or "prefix" (prefix command
is described at next section).
d45 1
a45 1
# ifconfig de0 inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 alias
d48 7
a54 5
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
d60 5
a64 6
In the IPv6 architecture, an IPv6 address of an interface can be
generated from a prefix assigned to the interface, and a
link-dependent identifier for the interface.  So assigning a full IPv6
address by ifconfig is not necessary anymore, because user can only
take care of prefix, by letting system take care of interface
identifier.
d70 1
a70 4
Advertisement (in case of hosts) and with prefixes assigned by Router
Renumbering (in case of routers).  Manual assignment of prefixes or
change of prefix properties take precedence over ones assigned by
Router Advertisement or Router Renumbering.
d72 6
a77 1
prefix command works only on routers.
d79 4
a82 1
If you want to assign a prefix (and consequently address) manually, do
d85 1
d88 7
a94 12
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
# prefix de0 3ffe:501:808:1::
# ifconfig de0
de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
d96 2
a97 2
To check assigned prefix, use the "ndp" command (See description of
ndp command about its usage).
d100 2
a101 2
3ffe:501:808:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
d107 2
a108 2
If you have multiple prefixes which have 3ffe:501:808:/48 at the top,
and would like to renumber them to 3ffe:501:4819:/48, then use the
d115 8
a122 5
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:808:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
d125 4
a128 3
        inet6 fe80::200:f8ff:fe55:7011%de1 prefixlen 64 scopeid 0x2
        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
        inet6 3ffe:501:808:2:200:f8ff:fe55:7011 prefixlen 64 
d130 3
a132 1
        media: 100baseTX status: active
d134 2
a135 2
3ffe:501:808:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
d137 2
a138 2
3ffe:501:808:2::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
d143 1
a143 1
# prefix -a matchpr 3ffe:501:808:: mp_len 48 usepr 3ffe:501:4819:: up_uselen 48 change
d150 7
a156 5
        inet6 fe80::200:f8ff:fe01:6317%de0 prefixlen 64 scopeid 0x1
        inet 163.221.202.12 netmask 0xffffff00 broadcast 163.221.202.255
        inet6 3ffe:501:4819:1:200:f8ff:fe01:6317 prefixlen 64 
        ether 00:00:f8:01:63:17 
        media: 100baseTX status: active
d159 4
a162 3
        inet6 fe80::200:f8ff:fe55:7011%de0 prefixlen 64 scopeid 0x2
        inet 163.221.203.12 netmask 0xffffff00 broadcast 163.221.203.255
        inet6 3ffe:501:4819:2:200:f8ff:fe55:7011 prefixlen 64 
d164 2
a165 1
        media: 100baseTX status: active
d167 2
a168 2
3ffe:501:4819:1::/64 if=de0
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
d170 2
a171 2
3ffe:501:4819:2::/64 if=de1
  flags=LA, vltime=2592000, pltime=604800, expire=Never, origin=RR
a175 1

d178 3
a180 3
If there is a router announcing Router Advertisement on a subnet,
you need not to add a default route for your host by hand
(Please refer to "sysctl" section to accept Router Advertisement).
d182 1
a182 1
If you want to add a default route manually, do like:
d184 1
a184 1
# route add -inet6 default fe80::200:a2ff:fe0e:7543%ed0
d186 1
a186 2
"default" means ::/0.  In other cases, if "prefixlen" is omitted, 64
is assumed for "prefixlen" to get along with the aggregatable address.
d188 5
a192 7
Note that, in IPv6, a link-local address should be used as gateway
("fe80::200:a2ff:fe0e:7543%ed0" in the above).  If you use global addresses,
ICMPv6 redirect will not work properly.  Also note that we use a special form
of link-local address as gateway.  See Section 1.3 of IMPLEMENTATION for
more details.
For ease of configuration we recommend you to avoid static routes and run
a routing daemon (route6d for example) instead.
d194 1
a194 2

<<<ping6>>>
d199 9
a207 9
% ping6 -n -I ed0 ff02::1

PING6(56=40+8+8 bytes) fe80::5254:ff:feda:cb7d --> ff02::1%ed0
56 bytes from fe80::5254:ff:feda:cb7d%lo0, icmp_seq=0 hlim=64 time=0.25 ms
56 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0, icmp_seq=0 hlim=64 time=1.333 ms(DUP!)
56 bytes from fe80::5254:ff:feda:d161%ed0, icmp_seq=0 hlim=64 time=1.459 ms(DUP!)
56 bytes from fe80::260:97ff:fec2:80bf%ed0, icmp_seq=0 hlim=64 time=1.538 ms(DUP!)
56 bytes from 3ffe:501:4819:2000:5054:ff:fedb:aa46, icmp_seq=0 hlim=255 time=1.615 ms(DUP!)

d215 1
a215 1
% ping6 -n -I ed0 -w ff02::1
d217 5
a221 6
64 bytes from fe80::5254:ff:feda:cb7d%lo0: fto.kame.net
67 bytes from fe80::5254:ff:feda:d161%ed0: banana.kame.net
69 bytes from fe80::2a0:c9ff:fe84:ebd9%ed0: paradise.kame.net
66 bytes from fe80::260:8ff:fe8b:447f%ed0: taroh.kame.net
66 bytes from fe80::2a0:c9ff:fe84:ed6c%ed0: ayame.kame.net
	
a241 1

d248 6
a253 6
nr60.v6.kame.net              0:60:97:c2:80:bf      ed0  expired   S    R 
3ffe:501:4819:2000:2c0:cff:fe 0:c0:c:10:3a:53       ed0  permanent R      
paradise.v6.kame.net          52:54:0:dc:52:17      ed0  expired   S    R 
fe80::200:eff:fe49:f929%ed0   0:0:e:49:f9:29        ed0  expired   S    R 
fe80::200:86ff:fe05:80da%ed0  0:0:86:5:80:da        ed0  expired   S      
fe80::200:86ff:fe05:c2d8%ed0  0:0:86:5:c2:d8        ed0  9s        R      
d255 1
a255 1
To flush all of the NDP cache entries, execute the following as root.
d259 1
a259 1
To display the prefix list:
d262 2
a263 2
3ffe:501:4819:2000::/64 if=ed0
  flags=LA, vltime=2592000, pltime=604800, expire=29d23h59m58s, origin=RA
d265 3
a267 3
    fe80::5254:ff:fedc:5217%ed0 (reachable)
    fe80::260:97ff:fec2:80bf%ed0 (reachable)
    fe80::200:eff:fe49:f929%ed0 (no neighbor state)
d269 1
a269 1
To display the default router list:
d272 3
a274 4
fe80::260:97ff:fec2:80bf if=ed0, flags=, expire=29m55s
fe80::5254:ff:fedc:5217 if=ed0, flags=, expire=29m7s
fe80::200:eff:fe49:f929 if=ed0, flags=, expire=28m47s

d281 15
a295 12
# ifconfig ef0
ef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
        media 10baseT status active
        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
# rtsol ef0
# ifconfig ef0
ef0: flags=8863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
        link type ether 0:a0:24:ab:83:9b mtu 1500 speed 10Mbps
        media 10baseT status active
        inet6 fe80::2a0:24ff:feab:839b%ef0 prefixlen 64 scopeid 0x2
        inet6 3ffe:501:4819:2000:2a0:24ff:feab:839b prefixlen 64
d304 1
a304 1
add -m option when invocation of rtsold.
a307 1

a309 1

d313 1
a313 1
	
d315 1
a315 4
# netstat -nrl
	long format with Ref and Use.  Note that bsdi4 does not support the
	-l option.  You should use the -O option instead.

a326 1

d333 1
a333 1
# gifconfig gif0 163.221.198.61 163.221.11.21
d348 1
a348 1
# ifconfig gif0 inet6 3ffe:501:808:5::1 3ffe:501:808:5::2 prefixlen 64 alias
d355 2
a356 1
IPv6-over-IPv4 tunnel) to connect to 6bone for simplicity.
a363 10

<<<6to4>>>

WARNING: malicious party can abuse 6to4 relay routers/sites, read through
internet draft draft-itojun-ipv6-transition-abuse-xx.txt before configuring it.

"stf" interface enables you to perform 6to4 IPv6-over-IPv4 encapsulation,
as documented in draft-ietf-ngtrans-6to4-06.txt.  See stf(4) for details.


a370 1

d373 3
a375 3
IPsec requires fairly complex configuration, so here we show transport
mode only.  http://www.kame.net/newsletter/ has more comprehensive
examples.
d377 1
a377 1
Let us setup security association to deploy a secure channel between
d381 1
a381 1
  
d392 1
a392 1
OK, let us assign SPI (Security Parameter Index) for each protocol.
d410 1
a410 1
	         (2.2) 
d425 1
a425 1
Now, let us setup security association.  Execute "setkey" on both HOST
d445 3
a447 2
	esp/transport//require
	ah/transport//require ;
d457 1
a457 1
	ah/transport//use \
d470 159
a661 8


<<Further readings>>

http://www.netbsd.org/Documentation/network/ipv6/
	Even if you are on non-netbsd operating system, the URL should be
	useful.
http://www.kame.net/
@


1.1.2.3
log
@Switch importer
@
text
@d4 1
a4 1
	$FreeBSD: stable/4/share/examples/IPv6/USAGE 79138 2001-07-03 11:02:18Z ume $
@


