Advertisement

[Closed]Route.exe help

Started by July 28, 2005 01:55 PM
9 comments, last by Aidamina 19 years, 6 months ago
I'm trying to get a program which connects to a server on the internet to connect to the same port only localhost with route.exe, but this fails. I know its a bit offtopic, but hey gd is sweet. im calling route add TargetInetip 127.0.0.1 or route add TargetInetip 192.168.1.3 where TargetInetip is the ip of the server connected to the internet and 192.168.1.3 the current ip of the computer in its network. Both things failed. I wrote a basic tcp server which should receive the connectiong but it doesnt detect any connection attempts ( it works with telnet though so there shouldn't be anything wrong with the server application ) Any suggestions, Maybe i ****'ed up in the route.exe syntax?? Thanks [Edited by - Aidamina on July 31, 2005 1:56:52 AM]
-->My Site<--
Using route you instruct your computer that packets meant for the program's server (say 12.34.56.78) should be sent through your loopback device or the network card of your backend network respectively.
However, on the networks connected to these cards, nobody is listening to the IP 12.34.56.78.

To pull this off, you have some options:
1. Disconnect from the internet, assign that IP 12.34.56.78 to your computer and see it connect. (Don't know if this fits your goal, though)
2. If you know the host name of the server you might pull this off by adding a line in your HOSTS-file, containing your own IP and the name of the server. Hopefully, when looking up the name, it will use your own IP and connect to your homegrown server.
3. Have a look at ARP.exe.
Advertisement
its not a host thats resolved just direct ip. Its not my goal to connect to localhost. eventually its just my goal to let the program connect to 98.76.54.32 instead of 12.34.45.67.

Need some help badly :P
-->My Site<--
Is the route registering in your routing table??

I always add a metric.....

route add connectIP 127.0.0.1 metric 1 if xxx

Where xxx specifies the network interface.
Add -p for a persistent route.
It doesnt work, the route shows up when i do route -a but for some reason its not connecting, by the way using 127.0.0.1 fails because the gateway isnt in the same network any suggestion?
-->My Site<--
"route" only tells IP which *route* to use. It does not change the destination IP address, only the path to get to that address.

As DaBono said, you have to add the ip address to the host. However, you should not need to disconnect it from the internet. Go into the control panel->network and add an IP address to the network card in question.

Advertisement
You can't do packet re-writing or IP tunneling only using "route". "Route" just tells the computer that, given a packet headed for address X, forward it along to the next hop of Y.
enum Bool { True, False, FileNotFound };
So what DO i need?
How do i make the program connect to a different ip,
dont tell me what not todo,
but tell me something what i should do!

[Edited by - Aidamina on July 29, 2005 2:25:50 PM]
-->My Site<--
I am still a bit unclear what you are trying to do. You need a bit more detail.
You say "connect on the same port" ?? Do you want it to reroute or to are you trying to duplicate traffic. You need to clarify it a bit.

I took your post as simply trying to take all traffic heading out on an IP to be rerouted back on loopback. This is not hard. Use ethereal to so what your traffic is doing. It should tell you where is is going. If you are still confused maybe show us some of your traffic with ping and your "route print".
You can multi-home your machine to have two IP addresses; one for the actual address, and one for the address you're faking out.

The easiest way to do this is to stick in a second ethernet adapter, and configure a static IP for that. When a machine is multi-homed, a route will already exist that forwards packets to your machine when they come from your machine.

Just don't expect other machines to be able to send to your machine, as the second IP will not ARP or route correctly compared to the network it sits on...
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement