Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm in the process of moving my old server to a new server, but i will keep the old server running for database replication and load balancing, etc. each server has a separate internet connection with a static ip, and they are connected through a local Ethernet connection. I've got Ubuntu 8.04 32-bit running on old server and Debian 6.0 64-bit on new one. shorewall firewall is installed on both servers. there are some outdoor devices which are periodically sending data to port 43597 for old server IP address. I can run multiple instances of the network service which is responsible for receiving data from devices on a server but on different ports.

here's the question:

how can I run the service on new server and have connections coming to old server redirected to it, and new devices can still connect to new server's IP address preferably on the same port and same service? until all devices get updated to send to new server.

I've tried a shorewall DNAT rule, but seems like new server's default route should be changed to ethernet connection, which breaks other things.

I also found about redir utility, but still haven't tried it.

is there any best practice or simple solution for such a scenario, i'm not aware of?

thanks in advance.

SOLVED

i finally got it to work by adding the following line at the top of shorewall masq file on old server:

+eth1           0.0.0.0/0   192.168.1.1 tcp     43597
share|improve this question

migrated from stackoverflow.com Mar 10 '11 at 15:57

This question came from our site for professional and enthusiast programmers.

2 Answers 2

  • Set up a squid reverse proxy
  • Use the redir util
  • Use netfilter, you need both DNAT and SNAT.
share|improve this answer
    
thanks, by netfilter do you mean shorewall? i have this rule in shorewall rules file: DNAT all loc:192.168.1.2:43597 tcp 43597 what should i add for SNAT? –  aliz Mar 9 '11 at 15:04
1  
netfilter is the linux kernel end of the firewall. shorewall and iptables are sample usermode application that manipulate netfilter tables. I'm not familiar with shorewall, but the idea is that you need to change both destinatin and source IP so your new server responds back to your old server instead of sending directly to the client. –  Erik Mar 9 '11 at 15:18

If you have a smart switch/router, you can likely do it within there (would have to have layer 3 capabilities to change packets on the fly). Failing that, the solution Erik gave is great.

You may wish to consider using hostnames instead of IPs in the future, as this is one of the main reasons DNS exists: so you can abstract away the IP in the future without affecting all sorts of other things.

share|improve this answer
    
i don't have a router, it's just a simple ADSL modem. also i know about DNS, but I've got busybox and glibc running on outdoor devices. and i still had no chance to get DNS to work with this combination, unisg /etc/resolv.conf file. any hint on that would be appreciated too –  aliz Mar 10 '11 at 11:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.