How to create an IP alias on Windows

2019-01-22 23:00发布

I need to create an alias for my network interface such that it can be accessed locally with either 127.0.0.1 or 33.33.33.33.

In *nix I would do this:

sudo ifconfig en1 inet 33.33.33.33/32 alias

It appears that the netsh tool may be able to do the same thing. If so, how? I've seen some examples that seem close, but I don't understand the options provided.

The motivation for this is to run two instances of JBossAS on the same machine without port offsets. Thus, they would need to use the same port numbers without conflicting.

标签: windows ip netsh
7条回答
时光不老,我们不散
2楼-- · 2019-01-22 23:56

You cannot add an alias in the GUI when using DHCP to get an address. The "netsh" command, however, is helpful to achieve this:

netsh interface ip add address "Local Area Connection" 192.168.2.2 255.255.255.0

This has to be done as an administrator.

Use "ipconfig" to check what the network interface is called. In my case it is "Local Area Connection".

查看更多
登录 后发表回答