views:

2233

answers:

11

Hello everybody!

I need to access a svn repository from home, that runs under the IP 192.168.0.10 in the work network. I can establish a SSH tunnel to my localhost. Now I have to map 192.168.0.10 in a way, that instead 127.0.0.1 is accessed. Does anybody know a way to do this under Windows?

Thanks in advance!

A: 

Can you reference the DNS name instead? You can override the IP address for a DNS name in your hosts file (C:\windows\system32\drivers\etc\hosts).

jwanagel
A: 

I'm not sure that's possible at all. What you could do would be to reference a DNS name instead. You can change the IP the DNS name points to using your hosts file.

Matthias Kestenholz
A: 

edit your hosts file located at %SystemRoot%\system32\drivers\etc\

Prakash
A: 

As I understand the question is that you have a subversion repository checked out on a laptop (or some other computer) that you checked out at work using the ip address 192.168.0.10, and now you're at home and want to use it.

Personally I wouldn't try any fancy network reordering (or modifying the hosts file) but just use the SSH tunnel to check out a fresh copy of the repository on the machine again. So that you'll be checking the source out from the 127.0.0.1 address. Then if you need to move changes over you could use patches between the two checked out copies. Granted it's not the most ideal solution but it will get you going quickly without messing about too much.

Though a better solution would be to convince work to allow access to the repository (with proper passwords, authentication, SSL etc) using a nicer method, say apache with dav_svn/webdav.

If they don't go for that then try and get them to provide a VPN so that you can continue to work with the repository using the work IP address.

Daemin
A: 

Why don't you just access svn via 127.0.0.1? Surely this would be a better solution?

You're faced with several issues here, if I understand correctly. There's only one way you can make this work, that is to have your home machine have an address of 192.168.0.10. Then, you specify the ssh local address with 192.168.0.10 instead of 127.0.0.1.

The remote ssh connection will also by 192.168.0.10.

E.g., ssh -l work_user -L 192.168.0.10:svn:192.168.0.10:svn work_ssh_host

This syntax is possible with OpenSSH.

This is all if I understand your situation correctly.

A more elegant solution is to use OpenVPN, and route connections over the VPN.

A: 

Hello @all,

thanks for your answers! :) I tried with the hosts-file, but that didn't work out, since I can only use the IP. In fact, the svn server has the IP 192.168.0.10 in the work network, not my laptop. Sorry for don't making this clear enough. Checking out the repository from localhost worked for me! :) Many thanks for your help!

+2  A: 

TortoiseSVN allows you to relocate your repository

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-relocate.html#tsvn-dug-relocate-dia-1:

If your repository has for some reason changed it's location (IP/URL). Maybe you're even stuck and can't commit and you don't want to checkout your working copy again from the new location and to move all your changed data back into the new working copy, TortoiseSVN → Relocate is the command you are looking for. It basically does very little: it scans all entries files in the .svn folder and changes the URL of the entries to the new value.

Or you can use svn command:

svn switch --relocate From_URL To_URL

Kasprzol
+1  A: 

When you're at work, edit your HOSTS file to have svn = 192.168.0.10; when you're at home, edit it to have svn = 127.0.0.1, and then access it, in both by using 'svn' as the server name.

Alternatively, use the "svn switch --relocate" command to change the repository location when you need to.

Roger Lipscombe
A: 

I think I have had the same situation before, I will have to find what the exact configuration though.

You can start by looking at PuTTY Portable, it supports SSH and you can "redirect" a local IP to a remote IP.

As far as I can remember, when you run PuTTY you can:

  1. First specify you local address and port (this will be where you will be pointing your SVN client, e.g. Tortoise)
  2. Then go to Connection->SSH->Tunnels-> specify your source port to redirect from (same as above), then specify the destination IP and port and click add

I think that should be it, it has been a while since I have done it.

Schalk
A: 

i know that persons ip

A: 

You should be able to add a loop back adapter to your laptop and assign it the IP of 192.168.0.10

Disable the loop back adapter when you are on the work network. -Not the most elegent solution, I Know :)

NimsDotNet