Determining what IP address a Unix based system has. This information will most likely be used when determining if two hosts are on the same network.
It may be necessary to determine what IP address a Unix/Linux based host has. This will vary with Unix variants. The caller should have root privileges when issuing any of these commands. The basic command you need to type at the command prompt is ifconfig. However, because of numerous variants in the options that follow, the caller will most likely have to have this information available. Unix is a case sensitive operating systems so ensure that the command is typed in lower case. From the command prompt it may look like the following
eth0 Link encap:Ethernet HWaddr 08:00:09:DF:16:35
inet addr:10.3.50.19 Bcast:10.3.50.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3786425 errors:173 dropped:0 overruns:0 frame:173
TX packets:107734 errors:70 dropped:0 overruns:0 carrier:70 +
Interrupt:3 Base address:0xf800 DMA chan:4
Take note of the second line after the command was issued. It starts out with inet addr: That is the information we were looking for. It contains the IP Address, and the Mask 0f 255.255.255.0
Now we will need to determine the gateway or router used by the system. To do this simply type route at the command.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.3.50.19 * 255.255.255.255 UH 0 0 0 eth0
10.3.50.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 10.3.50.1 0.0.0.0 UG 0 0 0 eth
Once again that returns a lot of information that we do not need to worry about. The only line we are concerned with is the bottom line that reads default. The default route ( gateway or router) for this machine is 10.3.50.1. Now we have enough information to determine if this system and the ZebraNet are on the same subnet.
Use this subnet calculator to determine if the Unix system and the Zebranet are on the same subnet.
eth0- represents the first Ethernet card in the system. Unix always starts counting at zero, hence the 0
Some variants of Unix want the system name of the interface. For example SCO names the 3Com 3Com 3C509 as a el30. Solaris names the same interface either le0 or hme0. Obviously with numerous different interfaces, and numerous flavors of Unix, we have no way of knowing what the customers interface will be named. They will have to provide this information. For reference the command will look like the following:
Notice: Zebra Technologies Corporation makes no representations about the suitability of this documentation for any purpose. It is provided ``as is", for your information only, without warranty of any kind, either expressed or implied, including, but not limited to, implied warranties of merchantability, fitness for a particular purpose and non-infringement.