Surprisingly some of above example of finding IP address from hostname will work is windows ditto. You can use ping and nslookup in exactly same way as shown above. Even hostname command is available in windows command prompt but I doubt about options "hostname -i". Another change is in command "ifconfig”, instead of "ifconfig" windows uses "ipconfig" command to find out the IP address of your computer in windows.
1) How of use ipconfig command in windows to find IP address
Here is an example of using ipconfig command in windows to find out IP address of our computer:
C:\Documents and Settings\stock_trader>ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : trading_system.com
IP Address. . . . . . . . . . . . : 192.24.112.23
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.24.112.254
Finding IP address from hostname in UNIX and Linux
1) IP address using hostname command in Unix/Linux
hostname -i
This is the easiest way of finding IP address of your computer but limitation is that sometime this option may or may not available in your UNIX machine. also limitation of hostname is that you can not find IP address of any other machine.
2) IP address using ping command in unix/linux
stock_trader@system:~/test ping trading_system
Pinging trading_system.com [192.24.112.23] with 32 bytes of data:
Reply from 192.24.112.23: bytes=32 time<1ms TTL=128
Reply from 192.24.112.23: bytes=32 time<1ms TTL=128
Reply from 192.24.112.23: bytes=32 time<1ms TTL=128
Ping is another simplest way of finding IP address or localhost or any other host if you know the hostname or computer-name just ping and it will display IP address associated with it. In above example IP address associated with trading_system is "192.24.112.23". Disadvantage of using ping is that you can not convert IP address back to hostname.
3) IP address using nslookup commadn in unix/linux
stock_trader@system:~/test nslookup trading_system
Name: trading_system.com
Address: 192.24.112.23
nslookup is my favorite command for getting IP address form hostname, its very powerful and advantage of it we can get either from hostname to IP address or from IP address to hostname. It can also be used to find IP address of your own host or any other machine in the network. In above example of nslookup we have displayed IP address associated with trading_system. If you want to find hostname form IP address you can just provide IP address instead of hostname
4) How to find IP address using ifconfig command
Ifconfig is another networking utility in UNIX or Linux which can be used to find IP address of your UNIX machine. ifconfig shows lot of information so I just grep on inet to find the IP address in below example, IP address associate with "trading_system.com" is "192.24.112.23". Limitation of
trading_system.com $ /sbin/ifconfig -a | grep inet
inet 192.24.112.23 netmask ffffff00 broadcast 192.24.112.255