Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Connect two ip addresses in different subnet

Posted on 2008-11-06
Medium Priority
Last Modified: 2012-05-05
I have two computers with two different ip addresses and subnet masks.
Computer1: ip address 10.57.x.x with subnet mask
Computer2: ip address 10.1.y.y with subnet mask, gateway 10.1.y.z

I need to write a C++ program in Computer1 which connects to Computer2 through an ethernet cross-over cable. What is the best way to do it?

Could it be possible to add another ip address 10.1.y.z in Computer 1 and pretend the gateway to communicate with Computer2? Any suggestions will be appreciated.
Question by:ssl1324
  • 2
LVL 29

Accepted Solution

Bill Bach earned 690 total points
ID: 22894967
A few ideas...

1) Is this a one-time transfer?  A crossover cable will not allow other communications anyway, so the IP addresses really wouldn't matter.  Just re-address one of the two boxes to the same subnet as the other one.  When you're done, re-address the machine back and plug it back into the 'Net.

2) Look into products like LapLink that allow transfer via USB, Serial, or Parallel cables instead.  Much easier to implement and you don't have to touch the networking side of things.

3) Depending on the OS, you may be able to add a second IP address to the existing NIC.  However, with a cross-over cable in use, this is a waste of effort, since the other IP address will be useless anyway.

4) You could simply add a second NIC, which is easy enough to do on most OS'es, and configure THAT one for your cross-over network link.

Author Comment

ID: 22895165
Thanks for your reply.

The ip addresses and subnet masks must be fixed. And the communication protocol has to be TCP/IP (i.e. through ethernet crossover cable).

Another requirement I forget to mention is that, Computer2 only accepts the fixed ip address which connects to it (i.e. only accept ip address 10.57.x.x). So Computer2 will check the TCP header and reject the connection if the ip address is not 10.57.x.x.

I have thought about adding another NIC but any other software suggestion will be appreciated.
LVL 29

Assisted Solution

by:Bill Bach
Bill Bach earned 690 total points
ID: 22896149
Why such strange requirements?  There is simply no way that this even makes sense in the typical world of computing.  Is this for a class assignment? Sounds like an ideal project for an OS/networking course to explore the innards of device drivers.

The only viable solution, given the constraints that you have provided, is to write your own version of an IP stack that makes the changes as you need them.  

If you can add additional devices in-line with the cross-over cable, then there are other options, such as adding a router in between the boxes, or even creating your own version of The Bongo Project (http://eagle.auc.ca/~dreid/) to implement your own physical layer in place of the Ethernet cross-over cable.  However, this does not follow your original specs.

Assisted Solution

Dawilliams earned 60 total points
ID: 22898292
Unless I completely don't understand what your trying to do BillBach is right this is a strange request/requirement. the two pc's simply will not talk to each other through a crossover cable with statically assinged ip's in different subnets. You could add another IP address to computer 2 on the same subnet as computer one and then they could communicate

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question