p When .Nm receives .Tn TCPv6 traffic, .Nm will relay the .Tn TCPv6 traffic to .Tn TCPv4 . Destination for relayed .Tn TCPv4 connection will be determined by the last 4 octets of the original .Tn IPv6 destination. For example, if .Li 3ffe:0501:4819:ffff:: is reserved for .Nm Ns , and the .Tn TCPv6 destination address is .Li 3ffe:0501:4819:ffff::0a01:0101 , the traffic will be relayed to IPv4 destination .Li 10.1.1.1 .
p To use .Nm translation service, an IPv6 address prefix must be reserved for mapping IPv4 addresses into. Kernel must be properly configured to route all the TCP connection toward the reserved IPv6 address prefix into the .Xr faith 4 pseudo interface, by using .Xr route 8 command. Also, .Xr sysctl 8 should be used to configure .Dv net.inet6.ip6.keepfaith to .Dv 1 .
p The router must be configured to capture all the TCP traffic toward reserved .Tn IPv6 address prefix, by using .Xr route 8 and .Xr sysctl 8 commands. .Ss Daemon mode When .Nm is invoked as a standalone program, .Nm will daemonize itself. .Nm will listen to .Tn TCPv6 port .Ar service . If .Tn TCPv6 traffic to port .Ar service is found, it relays the connection.
p Since .Nm listens to TCP port .Ar service , it is not possible to run local TCP daemons for port .Ar service on the router, using .Xr inetd 8 or other standard mechanisms. By specifying .Ar serverpath to .Nm Ns , you can run local daemons on the router. .Nm will invoke local daemon at .Ar serverpath if the destination address is local interface address, and will perform translation to IPv4 TCP in other cases. You can also specify .Ar serverargs for the arguments for the local daemon.
p If .Ar service is not given, .Li telnet is assumed, and .Nm will relay TCP traffic on TCP port .Li telnet . With .Ar service , .Nm will work as TCP relaying daemon for specified .Ar service as described above.
p If .Fl d is given, debugging information will be generated using .Xr syslog 3 . If .Fl p is given, .Nm will use privileged TCP port number as source port, for IPv4 TCP connection toward final destination. For relaying .Xr ftp 1 and .Xr rlogin 1 , .Fl p is not necessary as special program code is supplied.
p .Nm will relay both normal and out-of-band TCP data. It is capable of emulating TCP half close as well. .Nm includes special support for protocols used by .Xr ftp 1 and .Xr rlogin 1 . When translating FTP protocol, .Nm translates network level addresses in .Li PORT/LPRT/EPRT and .Li PASV/LPSV/EPSV commands. For RLOGIN protocol, .Nm will relay back connection from .Xr rlogind 8 on the server to .Xr rlogin 1 on client.
p Inactive sessions will be disconnected in 30 minutes, to avoid stale sessions from chewing up resources. This may be inappropriate for some of the services
q should this be configurable? . .Ss inetd mode When .Nm is invoked via .Xr inetd 8 , .Nm will handle connection passed from standard input. If it the connection endpoint is in the reserved IPv6 address prefix. .Nm will relay the connection. Otherwise, .Nm will invoke service-specific daemon like .Xr telnetd 8 , by using the command argument passed from .Xr inetd 8 .
p .Nm determines operation mode by the local TCP port number, and enables special protocol handling whenever necessary/possible. For example, if .Nm is invoked via .Xr inetd 8 on FTP port, it will operate as a FTP relay.
p The operation mode requires special support for .Nm in .Xr inetd 8 . .Sh EXAMPLES Before invoking .Nm Ns , .Xr faith 4 interface has to be configured properly. d -literal -offset # sysctl -w net.inet6.ip6.accept_rtadv=0 # sysctl -w net.inet6.ip6.forwarding=1 # sysctl -w net.inet6.ip6.keepfaith=1 # ifconfig faith0 up # route add -inet6 3ffe:501:4819:ffff:: -prefixlen 96 ::1 # route change -inet6 3ffe:501:4819:ffff:: -prefixlen 96 -ifp faith0 .Ed .Ss Daemon mode samples To translate .Li telnet service, and provide no local telnet service, invoke .Nm as either of the following: d -literal -offset # faithd # faithd telnet .Ed
p If you would like to provide local telnet service via .Xr telnetd 8 on
a /usr/libexec/telnetd , use the following command line: d -literal -offset # faithd telnet /usr/libexec/telnetd telnetd .Ed
p If you would like to pass extra arguments to the local daemon: d -literal -offset # faithd ftpd /usr/libexec/ftpd ftpd -l .Ed
p Here are some other examples. You may need .Fl p to translate rsh/rlogin services. d -literal -offset # faithd sshd # faithd login /usr/libexec/rlogin rlogind # faithd shell /usr/libexec/rshd rshd .Ed
p
However, you should be careful when translating rlogin or rsh
connections. See
.Sx SECURITY NOTICE
for more details.
.Ss inetd mode samples
Add the following lines into
.Xr inetd.conf 5 .
Syntax may vary depending upon your operating system.
d -literal -offset telnet stream faith/tcp6 nowait root faithd telnetd
ftp stream faith/tcp6 nowait root faithd ftpd -l
ssh stream faith/tcp6 nowait root faithd /usr/pkg/bin/sshd -i
.Ed
p .Xr inetd 8 will open listening sockets with enabling kernel TCP relay support. Whenever connection comes in, .Nm will be invoked by .Xr inetd 8 . If it the connection endpoint is in the reserved IPv6 address prefix. .Nm will relay the connection. Otherwise, .Nm will invoke service-specific daemon like .Xr telnetd 8 . .Sh EXIT STATUS .Nm exits with .Dv EXIT_SUCCESS
q 0 on success, and .Dv EXIT_FAILURE
q 1 on error. .Sh SEE ALSO .Xr faith 4 , .Xr route 8 , .Xr sysctl 8 .Rs .%A Jun-ichiro itojun Hagino .%A Kazu Yamamoto .%T "An IPv6-to-IPv4 transport relay translator" .%R internet draft .%N draft-ietf-ngtrans-tcpudp-relay-01.txt .%O work in progress material .Re .Sh SECURITY NOTICE It is very insecure to use .Xr rhosts 5 and other IP-address based authentication, for connections relayed by .Nm
q and any other TCP relaying services .
p
.Nm
itself does not implement access controls, as
it intends to implement transparent TCP relay services.
Administrators are advised to filter packets based on IPv6 address.
IPv6 destination address can be limited by
carefully configuring routing entries that points to
.Xr faith 4 ,
using
.Xr route 8 .
IPv6 source address needs to be filtered by using packet filters.
Documents listed in
.Sx SEE ALSO
have more discussions on this topic.
Under inetd mode of operation, you can limit the connection source by using
.Xr hosts.allow 5 .
.Sh HISTORY
The
.Nm
command first appeared in WIDE Hydrangea IPv6 protocol stack kit.