📄 rinetd.8
字号:
.\" Copyright (c) 1997, 1998, 1999, Thomas Boutell and Boutell.Com, Inc..\" This software is released for free use under the terms of.\" the GNU Public License, version 2 or higher..\".Dd February 18, 1999.Dt RINETD 8.Os LINUX.Sh NAME.Nm rinetd.Nd internet.Dq redirection server.Sh SYNOPSIS.Nm /usr/sbin/rinetd.Sh VERSIONVersion 0.62, 04/14/2003..Sh DESCRIPTION.Nm rinetdredirects TCP connections from one IP address and port to another. rinetdis a single-process server which handles any number of connections tothe address/port pairs specified in the file /etc/rinetd.conf. Since rinetd runs as a single process using nonblocking I/O, it isable to redirect a large number of connections without a severeimpact on the machine. This makes it practical to run TCP serviceson machines inside an IP masquerading firewall. rinetd does notredirect FTP, because FTP requires more than one socket..Pprinetd is typically launched at boot time, using the following syntax:.Pp/usr/sbin/rinetd.PpThe configuration file is found in the file /etc/rinetd.conf, unlessanother file is specified using the -c command line option. .Sh FORWARDING RULESMost entries in the configuration file are forwarding rules. Theformat of a forwarding rule is as follows:.Ppbindaddress bindport connectaddress connectport.PpFor example:.Pp206.125.69.81 80 10.1.1.2 80.PpWould redirect all connections to port 80 of the "real" IP address206.125.69.81, which could be a virtual interface, throughrinetd to port 80 of the address 10.1.1.2, which would typically be a machine on the inside of a firewall which has nodirect routing to the outside world..PpAlthough responding on individual interfaces rather than on allinterfaces is one of rinetd's primary features, sometimes it is preferable to respond on all IP addresses that belong to the server.In this situation, the special IP address 0.0.0.0can be used. For example:.Pp0.0.0.0 23 10.1.1.2 23.PpWould redirect all connections to port 23, for all IP addressesassigned to the server. This is the default behavior for mostother programs..PpService names can be specified instead of port numbers. On most systems,service names are defined in the file /etc/services..PpBoth IP addresses and hostnames are accepted forbindaddress and connectaddress..Pp.Sh ALLOW AND DENY RULESConfiguration files can also contain allow and deny rules. .PpAllow rules which appear before the first forwarding rule areapplied globally: if at least one global allow rule exists,and the address of a new connection does notsatisfy at least one of the global allow rules, that connectionis immediately rejected, regardless of any other rules. .PpAllow rules which appear after a specific forwarding rule apply to that forwarding rule only. If at least one allow ruleexists for a particular forwarding rule, and the address of a newconnection does not satisfy at least one of the allow rulesfor that forwarding rule, that connection is immediatelyrejected, regardless of any other rules..PpDeny rules which appear before the first forwarding rule areapplied globally: if the address of a new connection satisfiesany of the global allow rules, that connectionis immediately rejected, regardless of any other rules. .PpDeny rules which appear after a specific forwarding rule apply to that forwarding rule only. If the address of a newconnection satisfies any of the deny rules for that forwarding rule, that connection is immediately rejected, regardless of any other rules..PpThe format of an allow rule is as follows:.Ppallow pattern.PpPatterns can contain the following characters: 0, 1, 2, 3, 4, 5,6, 7, 8, 9, . (period), ?, and *. The ? wildcard matches any onecharacter. The * wildcard matches any number of characters, includingzero. .PpFor example:.Ppallow 206.125.69.*.PpThis allow rule matches all IP addresses in the 206.125.69 class C domain..PpHost names are NOT permitted in allow and deny rules. The performancecost of looking up IP addresses to find their corresponding namesis prohibitive. Since rinetd is a single process server, all otherconnections would be forced to pause during the address lookup..Pp.Sh LOGGINGrinetd is able to produce a log file in either of two formats:tab-delimited and web server-style "common log format.".PpBy default, rinetd does not produce a log file. To activate logging, add the following line to the configuration file:.Pplogfile log-file-location.PpExample: logfile /var/log/rinetd.log.PpBy default, rinetd logs in a simple tab-delimited format containingthe following information:.PpDate and time.PpClient address.PpListening host.PpListening port.PpForwarded-to host.PpForwarded-to port.PpBytes received from client.PpBytes sent to client.PpResult message.PpTo activate web server-style "common log format" logging,add the following line to the configuration file:.Pplogcommon.Sh COMMAND LINE OPTIONSThe -c command line option is used to specify an alternateconfiguration file..PpThe -h command line option produces a short help message..PpThe -v command line option displays the version number..Sh REINITIALIZING RINETDThe kill -1 signal (SIGHUP) can be used to cause rinetdto reload its configuration file without interrupting existingconnections.Under Linux\(tm the process id is saved in the file \fI/var/run/rinetd.pid\fRto facilitate the kill -HUP. An alternatefilename can be provided by using the <code>pidlogfile</code>configuration file option..Sh LIMITATIONSrinetd redirects TCP connections only. There isno support for UDP. rinetd only redirects protocols whichuse a single TCP socket. This rules out FTP..Sh BUGSThe server redirected to is not able to identify the host theclient really came from. This cannot be corrected; however,the log produced by rinetd provides a way to obtain thisinformation. Under Unix, Sockets would theoretically lose data when closed with SO_LINGER turned off, but in Linux this is not the case (kernel source comments support this belief on my part). On non-Linux Unix platforms, alternate code which uses a different trick to work around blocking close()is provided, but this code is untested. The logging is inadequate.The duration of each connection should be logged..Sh LICENSECopyright (c) 1997, 1998, 1999, Thomas Boutell and Boutell.Com, Inc.This software is released for free use under the terms ofthe GNU Public License, version 2 or higher. NO WARRANTYIS EXPRESSED OR IMPLIED. USE THIS SOFTWARE AT YOUR OWN RISK..Sh CONTACT INFORMATIONSee http://www.boutell.com/rinetd/ for the latest release.Thomas Boutell can be reached by email: boutell@boutell.com.Sh THANKSThanks are due to Bill Davidsen, Libor Pechachek, Sascha Ziemann, theApache Group, and many others who have contributed adviceand/or source code to this and other free software projects.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -