• 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!

One thought on “Port forwarding using xinetd on CentOS

  1. Singh
    October 21, 2013 at 5:38 pm

    How to test if it is working fine?

Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>