README revision 1.9
11.1SitojunConfiguring FAITH IPv6-to-IPv4 TCP relay
21.1Sitojun
31.1SitojunKazu Yamamoto and Jun-ichiro itojun Hagino
41.9Sitojun$KAME: README,v 1.6 2000/07/06 13:43:33 itojun Exp $
51.1Sitojun
61.1Sitojun
71.1SitojunIntroduction
81.1Sitojun============
91.1Sitojun
101.1SitojunFAITH is a IPv6-to-IPv4 TCP relay.  It performs tcp relay just as some of
111.1Sitojunfirewall-oriented gateway does, but between IPv6 and IPv4 with address
121.4Sitojuntranslation.
131.4SitojunTCP connections has to be made from IPv6 node to IPv4 node.  FAITH will
141.1Sitojunnot relay connections for the opposite direction.
151.1SitojunTo perform relays, FAITH daemon needs to be executed on a router between
161.1Sitojunyour local IPv6 site and outside IPv4 network.  The daemon needs to be
171.1Sitojuninvoked per each TCP services (TCP port number).
181.1Sitojun
191.1Sitojun	IPv4 node "dest" = 123.4.5.6
201.1Sitojun		|
211.1Sitojun	[[[[ outside IPv4 ocean ]]]]
221.1Sitojun		|
231.1Sitojun	node that runs FAITH-daemon (usually a router)
241.1Sitojun		|
251.1Sitojun	==+=====+===+==== IPv6, or IPv4/v6 network in your site ^
261.1Sitojun	  |	    |						| connection
271.1Sitojun	clients	  IPv6 node "src"				|
281.1Sitojun
291.1SitojunYou will have to allocate an IPv6 address prefix to map IPv4 addresses into.
301.9SitojunThe following description uses 3ffe:0501:ffff:0000:: as example.
311.1SitojunPlease use a prefix which belongs to your site.
321.1SitojunFAITH will make it possible to make a IPv6 TCP connection From IPv6 node
331.1Sitojun"src", toward IPv4 node "dest", by specifying FAITH-mapped address
341.9Sitojun3ffe:0501:ffff:0000::123.4.5.6
351.9Sitojun(which is, 3ffe:0501:ffff:0000:0000:0000:7b04:0506).
361.1SitojunThe address mapping can be performed by hand:-), by speical nameserver on
371.1Sitojunthe network, or by special resolver on the source node.
381.1Sitojun
391.1Sitojun
401.1SitojunSetup
411.1Sitojun=====
421.1Sitojun
431.1SitojunThe following example assumes:
441.9Sitojun- You have assigned 3ffe:0501:ffff:0000:: as FAITH adderss prefix.
451.1Sitojun- You are willing to provide IPv6-to IPv4 TCP relay for telnet.
461.1Sitojun
471.1Sitojun<<On the translating router on which faithd runs>>
481.1Sitojun
491.1Sitojun(1) If you have IPv6 TCP server for the "telnet" service, i.e. telnetd via
501.1Sitojun    inet6d, disable that daemon.  Comment out the line from "inet6d.conf"
511.1Sitojun    and send the HUP signal to "inet6d".
521.1Sitojun
531.1Sitojun(2) Execute sysctl as root to enable FAITH support in the kernel.
541.1Sitojun
551.1Sitojun        # sysctl -w net.inet6.ip6.keepfaith=1
561.1Sitojun
571.1Sitojun(3) Route packets toward FAITH prefix into "faith0" interface.
581.1Sitojun
591.9Sitojun	# ifconfig faith0 up
601.9Sitojun	# route add -inet6 3ffe:0501:ffff:0000:: -prefixlen 64 ::1
611.9Sitojun	# route change -inet6 3ffe:0501:ffff:0000:: -prefixlen 64 -ifp faith0
621.1Sitojun
631.1Sitojun(4) Execute "faithd" by root as follows:
641.1Sitojun
651.5Sitojun	# faithd telnet /usr/libexec/telnetd telnetd
661.1Sitojun
671.1Sitojun    1st argument is a service name you are willing to provide TCP relay.
681.1Sitojun	(it can be specified either by number "23" or by string "telnet")
691.1Sitojun    2nd argument is a path name for local IPv6 TCP server.  If there is a
701.1Sitojun    connection toward the router itself, this program will be invoked.
711.1Sitojun    3rd and the following arguments are arguments for the local IPv6 TCP
721.1Sitojun    server.  (3rd argument is typically the program name without its path.)
731.1Sitojun
741.1Sitojun    More examples:
751.1Sitojun
761.5Sitojun	# faithd login /usr/libexec/rlogin rlogind
771.5Sitojun	# faithd shell /usr/libexec/rshd rshd
781.5Sitojun	# faithd ftpd /usr/libexec/ftpd ftpd -l
791.1Sitojun	# faithd sshd
801.1Sitojun
811.9SitojunIf inetd(8) on your platform have special support for faithd, it is possible
821.9Sitojunto setup faithd services via inetd(8).  Consult manpage for details.
831.9Sitojun
841.1Sitojun
851.1Sitojun<<Routing>>
861.1Sitojun
871.1Sitojun(4) Make sure that packets whose destinations match the prefix can
881.1Sitojunreach from the IPv6 host to the translating router.
891.1Sitojun
901.1Sitojun<<On the IPv6 host>>
911.1Sitojun
921.1SitojunThere are two ways to translate IPv4 address to IPv6 address:
931.1Sitojun	(a) Faked by DNS
941.1Sitojun	(b) Faked by /etc/hosts.
951.1Sitojun
961.1Sitojun(5.a) Install "newbie" and set up FAITH mode. See kit/ports/newbie.
971.1Sitojun
981.1Sitojun(5.b) Add an entry into /etc/hosts so that you can resolve hostname into
991.1Sitojunfaked IPv6 addrss.  For example, add the following line for www.netbsd.org:
1001.1Sitojun
1011.9Sitojun	3ffe:0501:ffff:0000::140.160.140.252	www.netbsd.org
1021.1Sitojun
1031.1Sitojun<<On the translating router on which faithd runs.>>
1041.1Sitojun
1051.1Sitojun(6) To see if "faithd" works, watch "/var/log/daemon". Note: please
1061.1Sitojunsetup "/etc/syslog.conf" so that LOG_DAEMON messages are to be stored
1071.1Sitojunin "/var/log/daemon".
1081.1Sitojun
1091.1Sitojun	<e.g.>
1101.1Sitojun	daemon.*   /var/log/daemon
1111.1Sitojun
1121.1Sitojun
1131.9SitojunAccess control
1141.9Sitojun==============
1151.9Sitojun
1161.9SitojunSince faithd implements TCP relaying service, it is critical to implement
1171.9Sitojunproper access control to cope with malicious use.  Bad guy may try to
1181.9Sitojunuse your relay router to circumvent access controls, or may try to
1191.9Sitojunabuse your network (like sending SPAMs from IPv4 address that belong to you).
1201.9SitojunInstall IPv6 packet filter directives that would reject traffic from
1211.9Sitojununwanted source.  If you are using inetd-based setup, you may be able to
1221.9Sitojunuse access control mechanisms in inetd.
1231.9Sitojun
1241.9Sitojun
1251.1SitojunAdvanced configuration
1261.1Sitojun======================
1271.1Sitojun
1281.1SitojunIf you would like to restrict IPv4 destination for translation, you may
1291.1Sitojunwant to do the following:
1301.1Sitojun
1311.9Sitojun	# route add -inet6 3ffe:0501:ffff:0000::123.0.0.0 -prefixlen 104 ::1
1321.9Sitojun	# route change -inet6 3ffe:0501:ffff:0000::123.0.0.0 -prefixlen 104 \
1331.9Sitojun		-ifp faith0
1341.1Sitojun
1351.1SitojunBy this way, you can restrict IPv4 destination to 123.0.0.0/8.
1361.9SitojunYou may also want to reject packets toward 3ffe:0501:ffff:0000::/64 which
1371.9Sitojunis not in 3ffe:0501:ffff:0000::123.0.0.0/104.  This will be left as excerside
1381.1Sitojunfor the reader.
1391.1Sitojun
1401.1SitojunBy doing this, you will be able to provide your IPv4 web server to outside
1411.1SitojunIPv6 customers, without risks of unwanted open relays.
1421.1Sitojun
1431.6Sitojun	[[[[ IPv6 network outside ]]]]			|
1441.1Sitojun		|					| connection
1451.1Sitojun	node that runs FAITH-daemon (usually a router)	v
1461.1Sitojun		|
1471.6Sitojun	========+======== IPv4/v6 network in your site
1481.1Sitojun		|			(123.0.0.0/8)
1491.1Sitojun	IPv4 web server
150