在 Windows 上将 192.168.0.10 映射到 127.0.0.1

发布于 2024-07-04 06:33:04 字数 206 浏览 15 评论 0原文

我需要从家里访问 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

叫嚣ゝ 2024-07-11 06:33:04

TortoiseSVN 允许您重新定位存储库

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

如果您的存储库由于某种原因更改了其位置(IP/URL)。 也许您甚至陷入困境并且无法提交,并且您不想从新位置再次检出您的工作副本并将所有更改的数据移回到新的工作副本中,TortoiseSVN → Relocate 是您正在查找的命令为了。 它基本上做的事情很少:它扫描 .svn 文件夹中的所有条目文件并将条目的 URL 更改为新值。

或者你可以使用 svn 命令:

svn switch --relocate From_URL To_URL

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

夜深人未静 2024-07-11 06:33:04

当你在工作时,编辑你的 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.

南…巷孤猫 2024-07-11 06:33:04

您可以引用 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).

生死何惧 2024-07-11 06:33:04

我不确定这是否可能。 您可以做的是引用 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.

梦幻之岛 2024-07-11 06:33:04

编辑位于 %SystemRoot%\system32\drivers\etc\ 的主机文件

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

樱桃奶球 2024-07-11 06:33:04

据我了解,问题是您在笔记本电脑(或其他计算机)上签出了一个颠覆存储库,您在工作时使用 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.

狠疯拽 2024-07-11 06:33:04

为什么不直接通过 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.

东风软 2024-07-11 06:33:04

我想我以前也遇到过同样的情况,但我必须找到确切的配置。

您可以首先查看 PuTTY Portable,它支持 SSH,并且您可以使用可以将本地IP“重定向”到远程IP。

据我记得,当你运行 PuTTY 时,你可以:

  1. 首先指定你的本地地址和端口(这将是你指向 SVN 客户端的位置,例如 Tortoise)
  2. 然后转到 Connection->SSH->Tunnels- > 指定要重定向的源端口(与上面相同),然后指定目标 IP 和端口并单击“添加”

我认为应该是这样,我已经有一段时间没有这样做了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文