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).
1. Install the package for RedHat / CentOS 6
|
# yum search portreserve # yum install portreserve |
2. Download a package for RedHat / CentOS 5
Ex.
| # rpm -ihv portreserve-0.0.5-2.el5.rf.x86_64.rpm |
3. Check portreserve program
|
# which portreserve # chkconfig --list | grep portreserve |
4. Create the service Name file in /etc/portreserve
The file name is considered to be a service name (as listed in /etc/services).
| --------------- /etc/services ------------------------ http 80/tcp www www-http # WorldWideWeb HTTP http 80/udp www www-http # HyperText Transfer Protocol ------------------------------------------------------- |
5. Edit the configuration file
Ex. /etc/portreserve/http might contain the string "http" ( <service name> )
or, equivalently, "http/tcp" and "http/udp" on separate lines ( <service name>/<protocol> ).
| # vi /etc/portreserve/http |
6. /etc/portreserve/http
| http |
OR
| http/tcp http/udp |
7. To release the port held
| # portrelease http |
8. To reserve all ports again
|
# service portreserve restart OR # /etc/init.d/portreserve restart |
9. Service configuration files
/var/run/portreserve/socket : communication socket for portrelease.