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:
There is a comment about how to add alias while still using DHCP for the main one. I have similar problem.
The solution is:
(1) Add Microsoft Loopback Adapter as a network device (taken from here):
From that point on it's the same approach as under Vista, i.e.:
(2) To see the newly added network interface, and specify an IP address:
for anyone coming, as i have, from google:
another way to accomplish this is to set a route and set the destination to understand the ip, an example:
recently at our company our service was stopped for our T1, some old software that no one had the code for hard coded the external address of our server and we needed to make it go to an internal address of 192.168.2.100 so i set this route on the client machines:
route -p add 208.44.37.176 MASK 255.255.255.248 192.168.2.100 METRIC 1
and on the server i set it's interface to listen on 208.44.37.182
so when the client tries to connect to 208.44.37.182 it would check the routing table, it would do a bitwise AND on the netmask for anything in the routing table to match to the routing address (the 208.44.176) and then route it to the gateway (192.168.2.100) failing this is routes to the default gateway.
so in this case it routes it through to 192.168.2.100 who sees it's addressed to him and replies in turn. if he wasn't listening on 208.44.37.182 then he would ignore it (or, if he is configured to do so, pass it along til someone takes it or drops it)
(for those curious about why that netmask:
182 is 10110110
248 is 11111000
176 is 10110000
for a bitwise AND if one of the two bits is 0, the result is 0, if they are both 1 it's 1. so you see taking 182 and bitwise ANDing it to 248 gives 176)
those are the things i learned when working on this, hope it helps someone else.
You'd be correct. Also, you can add multiple addresses without touching the command line using the advanced interface properties screen.
netsh interface ip add address "Local Area Connection" 33.33.33.33 255.255.255.255
go to C:\Windows\System32\drivers\etc\hosts on windows and add a new entry as below
eg: 106.200.247.101 abc.com
Then you will be able to refer to using given hostname
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".
I found the answer.
If you obtain your IP address from DCHP, you don't need to configure IP address (making sense knowing that it is the service of a DCHP) so all you need to do is to determine the gateway.