在 Windows 上将 192.168.0.10 映射到 127.0.0.1
我需要从家里访问 SVN 存储库,该存储库在工作网络中的 IP 192.168.0.10
下运行。 我可以建立一个到本地主机的 SSH 隧道。 现在我必须以某种方式映射 192.168.0.10
,而不是访问 127.0.0.1
。 有谁知道在 Windows 下执行此操作的方法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
TortoiseSVN 允许您重新定位存储库
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-relocate.html#tsvn-dug-relocate-dia-1:
或者你可以使用 svn 命令:
TortoiseSVN allows you to relocate your repository
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-relocate.html#tsvn-dug-relocate-dia-1:
Or you can use svn command:
当你在工作时,编辑你的 HOSTS 文件以包含 svn = 192.168.0.10; 当您在家时,将其编辑为 svn = 127.0.0.1,然后使用“svn”作为服务器名称来访问它。
或者,在需要时使用“svn switch --relocate”命令更改存储库位置。
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.
您可以引用 DNS 名称吗? 您可以覆盖主机文件 (C:\windows\system32\drivers\etc\hosts) 中 DNS 名称的 IP 地址。
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).
我不确定这是否可能。 您可以做的是引用 DNS 名称。 您可以使用主机文件更改 DNS 名称指向的 IP。
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.
编辑位于
%SystemRoot%\system32\drivers\etc\
的主机文件edit your hosts file located at
%SystemRoot%\system32\drivers\etc\
据我了解,问题是您在笔记本电脑(或其他计算机)上签出了一个颠覆存储库,您在工作时使用 IP 地址 192.168.0.10 签出了该存储库,现在您在家并想要使用它。
就我个人而言,我不会尝试任何花哨的网络重新排序(或修改主机文件),而只是使用 SSH 隧道再次检查计算机上存储库的新副本。 这样您就可以从 127.0.0.1 地址检查源。 然后,如果您需要移动更改,则可以在两个签出的副本之间使用补丁。 当然,这不是最理想的解决方案,但它会让您快速前进,而不会造成太多麻烦。
尽管更好的解决方案是说服工作人员允许使用更好的方法访问存储库(使用正确的密码、身份验证、SSL 等),例如使用 dav_svn/webdav 的 apache。
如果他们不这样做,请尝试让他们提供 VPN,以便您可以继续使用工作 IP 地址使用存储库。
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.
为什么不直接通过 127.0.0.1 访问 svn 呢? 这肯定是一个更好的解决方案吗?
如果我理解正确的话,您在这里面临几个问题。 只有一种方法可以实现此目的,那就是让您的家用计算机的地址为 192.168.0.10。 然后,使用 192.168.0.10 而不是 127.0.0.1 指定 ssh 本地地址。
远程 ssh 连接也将通过 192.168.0.10 进行。
例如, ssh -l work_user -L 192.168.0.10:svn:192.168.0.10:svn work_ssh_host
此语法可用于 OpenSSH。
如果我正确理解你的情况的话,这就是全部。
更优雅的解决方案是使用 OpenVPN,并通过 VPN 路由连接。
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.
我想我以前也遇到过同样的情况,但我必须找到确切的配置。
您可以首先查看 PuTTY Portable,它支持 SSH,并且您可以使用可以将本地IP“重定向”到远程IP。
据我记得,当你运行 PuTTY 时,你可以:
我认为应该是这样,我已经有一段时间没有这样做了。
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:
I think that should be it, it has been a while since I have done it.