• centosblog_icon_b_64

Port forwarding using xinetd on CentOS

An easy method to do port forwarding on CentOS is to use xinetd. This service is usually installed on CentOS by default.

In order to port forward with xinetd, you will need to create a configuration file:

vim /etc/xinetd.d/smtp_forward

Some xinetd port forwarding examples:

1. Forward port 2000 on localhost to remote server on port 25:
service smtp_forward
{
        disable         = no
        type            = UNLISTED
        socket_type     = stream
        protocol        = tcp
        user            = nobody
        wait            = no
        redirect        = remote_server 25
        bind            = 127.0.0.1
        port            = 2000
}
 2. Forward port 2000 on all IPs to remote server on port 25:
service smtp_forward
{
        disable         = no
        type            = UNLISTED
        socket_type     = stream
        protocol        = tcp
        user            = nobody
        wait            = no
        redirect        = remote_server 25
        port            = 2000
}

Once you have created your xinetd configuration file, you must reload xinetd for the changes to take effect:

/etc/init.d/xinetd reload
Scan to Donate Bitcoin
Like this? Donate Bitcoin to at:
Bitcoin 14M4a7UHEX61VoHkyjj4dxbUBNGGz3hmhM
Donate
Share This Post

About Author: Curtis K

Hi! My name is Curtis, and I am the creator of CentOS Blog. Please feel free to comment any suggestions, feedback or questions on my posts!

  • Singh

    How to test if it is working fine?