XRPi Home

Documentation Index
Alphabetic Index

XRPi Documentation - Servers

TCP Service Ports

Name

TCP-PORTS -- TCP Service Ports.

Description

TCP service numbers or "service ports" (not to be confused with radio PORTs), are standard or "well known" numbers between 0 and 65535 which are used in combination with an IP address to access a particular process (usually a server) on a system.

The default TCP service port numbers for XRPi's servers, and the corresponding configuration keywords used in XROUTER.CFG are as follows:

            Keyword     TCP Port    Service Name
            --------------------------------------------
            ECHOPORT           7    Echo server
            DISCARDPORT        9    Discard server
            FTPPORT           21    FTP server
            TELNETPORT        23    Telnet server
            FINGERPORT        79    Finger server
            HTTPPORT          80    HTTP server
            TTYLINKPORT       87    Raw TTY link
            RLOGINPORT       513    Remote login
            SOCKSPORT       1080    Socks proxy server
            APRSPORT        1448    APRS server
            TELPROXYPORT    2323    Telnet proxy server
            CHATPORT        3600    Chat server
            AGWPORT         8000    AGW TCP host API
            RHPPORT         9000    XRouter host API

By default, all the above services are enabled, on all of XRPi's IP addresses. I.e. the global IPADDRESS and any port overrides.

If you are not using the EXTERNAL interface to share the Ethernet adaptor, the default case is that these services will also be available via the Linux kernal IP addresses.

If you are using the EXTERNAL interface to share the Ethernet adaptor, these services will NOT be available via the Linux kernal IP addresses unless you explicitly say so (see below).

See LAN Interfacing for more information on using the EXTERNAL interface.

Overriding Default TCP Service Ports

You may wish to disable services, or change the TCP ports they use.

For instance, you may need to move the Telnet port if you have another process using TCP port 23 on the same machine. Or you may wish to disable the SOCKS server because you don't need it.

You may also choose to make some services available on XRPi's TCP/IP stack and not on Linux's stack, or vice versa.

To override the default, use one or more of the above configuration keywords in the GLOBAL section of XROUTER.CFG.

If you use the keyword without an argument, or with an argument of zero, that service is disabled.

For example, the following formats disable the Telnet server on both XRPi and Linux IP stacks:

	TELNETPORT=
	TELNETPORT=0

If you use the keyword with a single argument, the result depends on whether you are using the EXTERNAL interface or not.

If you are using the EXTERNAL interface, the argument applies only to the XRPi stack.

If you are not using the EXTERNAL interface, the argument applies to BOTH stacks.

With those rules in mind, the following example moves the Telnet server from the default port (23), to port 88:

	TELNETPORT=88

If you supply TWO arguments, the first always applies to XRPi's stack and the second always applies to the Linux stack.

You may supply different numbers for each stack, or disable one and not the other. The numbers must be separated by whitespace, NOT commas.

For example, the following specifies that the TELNET server shall use TCP port 88 on XRPi's TCP/IP stack, and port 89 on the Linux stack:

	TELNETPORT=88 89

This one disables the Telnet server on XRPi's TCP/IP stack, whilst enabling it for port 88 on the Linux stack:

	TELNETPORT=0 88

Finally, this example enables the Telnet server on XRPi's TCP/IP stack, whilst disabling it on the Linux stack:

	TELNETPORT=88 0

Caveats

Unless you run XRPi with root privileges, you will NOT be able to open any port number less than 1024 on the Linux stack.

E.g. if XRPi is not running as root and you use the directive:

	RLOGINPORT=0 513
you will get an error like this:
	Error 13 opening RLogin server port 513

Moving the port above 1023, e.g. 7513 would solve the problem, providing you could remember the port number!

Another option if you are not running XRPi as root would be to use setcap to allow the program to access ports below 1024 as follows:

	sudo setcap cap_net_bind_service=pe xrpi

This will overwrite any previous capability set on that file, so if you are using the EXTERNAL interface, you also need to set the CAP_NET_RAW capability as follows:

	sudo setcap cap_net_raw,cap_net_bind_service=pe xrpi

Another option is to use rinetd to redirect connections to a higher port number. For instance the following line in rinetd's configuration:

	192.168.0.10    513      127.0.0.1   8000

would forward connections to port 513 on address 192.168.0.10 to localhost port 8000 which XRPi can listen on even without root privileges.

Finally, you could simply disable the port on the Linux stack, for example:

	TELNETPORT=23 0

See also

IP-STACKS(9) -- TCP/IP Stacks in XRPi.
SERVERS(6) -- Servers in XRPi.
XROUTER.CFG(8) -- Main Configuration File.