Saturday, June 20, 2009

Minimize Downtime(DNS propagation) using tcp packet forwarding using TCPPROXY

A TCP proxy is a server that acts as an intermediary between a client and another server, called the destination server. Clients establish connections to the TCP proxy server, which then establishes a connection to the destination server. The proxy server sends data received from the client to the destination server and forwards data received from the destination server to the client.

It can be used to forward all the tcp connections to another ports in another server. This can be very effective during server migration time when we may face downtime due to DNS propagation delay. The DNS update in the nameservers will sometimes take more than 24 hours to fully propagate in the internet and as a result all the requests from the nameservers that are not updated will be accessing the old server. The old server might be either not accessible or showing old contents or we may be updating the old server with new data. This is especically critical when it comes to emails. We may sent emails to the wrong server which may become unavailable.

In these kind of circumstances we can initiate a forwarding setting which will forward all the requests that were sent to the old server to be forwarded to the new server. This can be accomplished by many free softwares licensed by GPL. In my case I used TCPPROXY a C++ application simple to install and setup as a proxy.

Installation and setup of tcpproxy for redirecting all traffic to another server

wget http://www.quietsche-entchen.de/download/tcpproxy-2.0.0-beta15.tar.gz

tar zxf tcpproxy-2.0.0-beta15.tar.gz

cd tcpproxy-2.0.0-beta15

make all


Setup tcpproxy as a proxy:

Suppose I have a old server 192.168.1.12 and new server 192.168.15.20 then I will have to forward all http requests to port 80 in old server to port 80 in new server. This can be accomplished using the command in the old server.

tcpproxy -b 80 192.168.15.20:80


General syntax:

Whatever maybe the service that you are using the general syntax would be

tcpproxy -b source port destination server:destination port

Suppose I want to use SMTP then the syntax would be

tcpproxy -b 25 192.168.15.20:25

Service not supported:

* FTP is not supported because it uses a second TCP connections for data transmission

1 comment:

  1. A IEEE project is an interrelated arrangement of exercises, having a positive beginning and end point and bringing about an interesting result in Engineering Colleges for a particular asset assignment working under a triple limitation - time, cost and execution. Final Year Project Domains for CSE In Engineering Colleges, final year IEEE Project Management requires the utilization of abilities and information to arrange, plan, plan, direct, control, screen, and assess a final year project for cse. The utilization of Project Management to accomplish authoritative objectives has expanded quickly and many engineering colleges have reacted with final year IEEE projects Project Centers in Chennai for CSE to help students in learning these remarkable abilities.



    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

    ReplyDelete