我正在我的 PC 上测试一个应用程序,这个应用程序连接到各种服务器,所以我需要在我的盒子上模拟它。
如何将主机名映射到 127.0.0.1?
localhost已经指的是 127.0.0.1,但我怎么能在 127.0.0.1 中添加更多诸如server-1和 之类的东西server-2?
我在 Windows 7 上。
谢谢
Lin*_*000 14
只需编辑您的hosts文件并使用它来指向 127.0.0.1 或您机器的本地 IP 地址。
该文件通常位于: /windows/system32/drivers/etc
例如 - 这是我的,我一直在测试一些“服务器”,如您所见:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.202.32 feng
192.168.202.241 helpdesk
192.168.202.241 wiki
192.168.202.241 rs
192.168.202.241 precurio
192.168.202.241 zendto
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30683 次 |
| 最近记录: |