IP Address
Hi,
I'm new to linux. I need to know ip address for my pc. I entered "/sbin/ifconfig" in turn i got the same from inet addr: xxx.xxx.x.xxx Now I need to cross check ip whether really is that my ip address. Plz tell some other command to check ip address. If i put that ip address shown through new command should match the ip address retrieved from "/sbin/ifconfig". Plz guide me. |
cross check? ifconfig will tell you the addresses of all local interface, there's no need to check it with anything else. Maybe you mean somethign different to what you are asking?
|
IP Address
What im asking is when I put /sbin/ifconfig Im getting the below response.
eth0 Link encap:Ethernet HWaddr 00:17:7C:10:4F:50 inet addr:192.168.2.200 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::217:7cff:fe10:4f50/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:154835 errors:0 dropped:0 overruns:0 frame:0 TX packets:159843 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:30268603 (28.8 MiB) TX bytes:39755892 (37.9 MiB) Interrupt:225 I want to cross check whether "inet addr" is my ip or "Bcast" or "Mask" are my ips... If any options apart from this is available means I will check with that command. So help me... |
Recommend you be careful posting exact outputs of things like addresses, or usernames to the forum. Probably the riskiest thing to post there is your MAC address.
acid_kewpie already answered, however you need some clarification. Your IP address IS the inet addr. This is the answer to your question. Your Bcast is the broadcast address for the IP sub-network which you are in. Your Mask determines the IP sub-network type which you are in. Class A would have a Mask of 255.0.0.0. Class B would have a Mask of 255.255.0.0. Class C would have a Mask of 255.255.255.0 The reason for this is called sub-netting, sort of like phone number areas codes and prefixes. Example two phone numbers: 978-555-1212 408-555-1212 The area codes are different; however the prefixes and the final four numbers are all the same. But these are two different phone numbers. Not sure, but I'm betting that you can have the same area code, prefix, and phone number in different countries where the difference would be the prefix. It really would depend if both countries used the same number of dialing digits. To extend that further, there is an address translation performed by your router. The router gives out 192.168.2.xxx addresses; however the actual IP address seen publicly is translated by your router. What it really does is multiplexes all addresses on your side of the network through the one address it has on it's externally facing side - the side attached to the broader, more public network. So consequently, you and I can have the exact same IP address of 192.168.2.200; however mine is within my corporate or home network, and yours is within your local network; and then our routers which attach us to the internet or corporate network use one or more series of address translation (multiplexing) to combine local network users for public access. Similarly an ISP will do the same thing. They get one or a few public IP addresses for the internet and they create a network underneath that hierarchy and can have any class of network they wish, so long as they use address translation for all their users to allow their sessions to be visible externally to the global internet. |
IP Address
Thanks for your posts and advices. But you have missed out my point. I need some other command to check my ip. Is there anything apart from /sbin/ifconfig??
Plz clear me. |
Try this:
Code:
ip addr show eth0 Code:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 BTW: ifconfig is slowly being phased out, ip is its replacement. |
IP Address
Hi,
Below error is coming when I entered the command given by u. [oracle@oraclehost shell]$ ip addr show eth0 -bash: ip: command not found [oracle@oraclehost shell]$ Plz assist me. Plz give me some other command. |
What's wrong with ifconfig? Why can't you use that? You were given an alternative and still had a problem. Is this just you asking questions, or are you writing a script or program and needing to obtain your IP address in a particular format?
|
@jknath: It seems ip isn't present/installed. Which linux distro and version are you using?
|
IP Address
No. As im a newbie I had curiosity to cross check. Its a healthy practice to me.
Thats y im asking this much time. Im ok with ifconfig. But if any command is there means I would be happy. Sorry for continuously asking. Thanks |
Member Response
Hi,
Welcome to LQ! Look at these links, especially #2,3 ,9 &10 also others will be helpful to investigate; Quote:
|
Code:
$ /sbin/ifconfig Code:
$ lynx --dump http://ipecho.net/plain |
This may help
http://www.whatismyip.com/linux-ip-commands/
Quote:
|
All times are GMT -5. The time now is 01:42 AM. |