Title: Using IP aliasing along with port redirect?

To anyone who can help,

I have a client/server program in which the server always sends tcp packets to a hard coded 1720 port.  I would like to be

able to run multiple clients on one machine and have tried using ip aliasing along with redirecting packets to get this done.

I have added an extra IP alias, giving me two ip addresses on the box.  My ifconfig looks like the following:

eth0      Link encap:Ethernet  HWaddr 00:ff:27:ff:18:76 
          inet addr:xxx.xxx.xxx.42  Bcast:xxx.xxx.xxx.63  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:143463 errors:0 dropped:0 overruns:0 frame:1
          TX packets:128286 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          Interrupt:22 Base address:0xd000

eth0:0    Link encap:Ethernet  HWaddr 00:ff:27:ff:18:76 
          inet addr:xxx.xxx.xxx.43  Bcast:xxx.xxx.xxx.63  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:22 Base address:0xd000

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:3924  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0

The first client runs on eth0/port 1720 and runs fines.  I am running a second client on port 1721 using the eth0:0 ip address.  When the server attempts to make a tcp connection back to xxx.xxx.xxx.43 port 1720, I want to redirect it to port 1721 instead since my first client is already using port 1720.  To do this, I have setup an ipchains rule as follows:

target     prot opt     source                destination           ports
REDIRECT   tcp  ------  anywhere             xxx.xxx.xxx.43          any ->   1720 => 1721

Unfortunately, the server is unable to make the tcp connection with this setup.  Does anyone have any clues on what I may be doing wrong or if I am approaching the problem correctly?

Thanks,
Gabriel Davidov
Nortel Networks

Reply via email to