• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Linux OS Service ‘portreserve’

By admin

The portreserve program aims to help services with well-known ports that lie in the portmap range. It prevents portmap from a real service’s port by occupying it itself, until the real service tells it to release the port (generally in the init script).

For example the cups package provides /etc/portreserve/cups.

# cat /etc/portreserve/cups 
ipp

In /etc/services, it is defined “service-name ipp” is equal to 631 ports. When portreserve service starts, portreserve reserves 631 ports.

# cat /etc/services | grep -w ipp
ipp             631/tcp                         # Internet Printing Protocol
ipp             631/udp                         # Internet Printing Protocol
# netstat -lanp | grep 631
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1628/portreserve

Configuration Files

– /etc/portreserve/* – Service configuration files
– /var/run/portreserve/socket – communication socket for portrelease

What happens when portrelease daemon starts

When the portreserve daemon is started, it examines the /etc/portreserve/ directory. Each file not containing “.” or “~” in its name is considered to be a service configuration file, and must contain a service name (as listed in /etc/services) or a port number. UDP services may be specified by appending “/udp” to the service name, and TCP services by “/tcp“. Several services may be specified, one per line.

For example, /etc/portreserve/cups might contain the string “ipp” or, equivalently, “ipp/tcp” and “ipp/udp” on separate lines.

For each service configuration file, a socket is created and bound to the appropriate port. A service wishing to bind to its port must first run portrelease, which instructs portreserve to release the port associated with the service.

Once all the reserved ports have been released, the daemon exits.

Filed Under: Linux, Linux Services

Some more articles you might also be interested in …

  1. Installing CentOS / RHEL 7 (step by step with screen shots)
  2. pvcreate error : Can’t open /dev/sdx exclusively. Mounted filesystem?
  3. How to Configure YUM to connect to Oracle Public Repository in Oracle Enterprise Linux
  4. Linux OS Service ‘vncserver’
  5. How to gzip all or specific files in Linux
  6. Understanding Variables in Bash Shell Under Linux
  7. “su: Authentication failure” – in Docker
  8. Sample /etc/mke2fs.conf file
  9. CentOS / RHEL 6 : How to rebuild Initial Ramdisk Image
  10. 18 Practical tcpdump Command Examples – A Network Sniffer Tool Primer

You May Also Like

Primary Sidebar

Recent Posts

  • How to set the default character set in MySQL and how to propagate it in a master-master replication scenario
  • “Connection reset by peer” – error while ssh into a CentOS/RHEL system with a specific user only
  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary