LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can I find my Internet Protocol Address (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-find-my-internet-protocol-address-676227/)

Eric Ruhumuliza 10-14-2008 06:01 AM

How can I find my Internet Protocol Address
 
I just want to see my Internet Protocol address

b0uncer 10-14-2008 06:08 AM

Either run (for information on all ethernet devices)
Code:

ifconfig
or (for information on specific ethernet device, in this case eth0)
Code:

ifconfig eth0
and you'll see your IP and other information, if you have a direct connection to the internet (i.e. not trough Local Area Network). If you are inside a LAN, you'll only see your LAN IP address, in which case it's probably easier to just visit a site like whatismyip.com which will happily tell you your external IP.

Welcome to LQ!

Vit77 10-14-2008 08:32 AM

Almost the same result, but in "new" style.

Code:

ip addr show

harry2006 10-14-2008 09:27 AM

Quote:

Originally Posted by Vit77 (Post 3309710)
Almost the same result, but in "new" style.

Code:

ip addr show

what is this? never heard of this?

Vit77 10-14-2008 09:49 AM

Quote:

Originally Posted by harry2006 (Post 3309755)
what is this? never heard of this?

It's sort of new utility with some new possibilities.
In general, it could work as a replacement for a majority of different Unix network commands.

It allows to operate with IP addresses and aliases, routes, etc.
Understands short abbreviations of commands, such as
Code:

ip addr show = ip ad sh
ip route = ip ro

etc.

Some examples.
Code:

ip addr add 10.0.0.10/16 dev eth0
ip link set eth0 up
ip route add 20.0.0.0/8 via 10.0.0.1
ip link show
ip addr show

---

Using aliases:
ip ad ad 10.0.0.1/24 dev eth0
ip ad ad 20.10.1.1/16 dev eth0
ip li set eth0 up

It's easier to type such short commands.
I think it's quite good replacement for old Unix network commands.

Edit:
I forget about the main command:
Code:

ip help
ip command help
etc.


rickh 10-14-2008 10:18 AM

Of course, the OP probably wants his external address.

Getting that from the command line is a little tricky. I've seen it demonstrated, but can't remember how. One could of course look at the main Router Page in a browser, but for most non-technical people, looking at one of the 40 gazillion web pages that display it is probably the easiest.

WhatIsMyIPAddress.com might work.

Edit: Oops, sorry! B0uncer already said that.

ritam_bkp 10-14-2008 02:15 PM

Quote:

Originally Posted by Vit77 (Post 3309710)
Almost the same result, but in "new" style.

Code:

ip addr show


this "ip" command does not work 4 me??

ncsuapex 10-14-2008 02:17 PM

If he's trying to get his external IP from the command line he can use wget:


wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

loperz7 10-14-2008 03:37 PM

http://www.ipchicken.com/

Gentoo

paperbag 10-14-2008 04:57 PM

Quote:

Originally Posted by ncsuapex (Post 3310011)
If he's trying to get his external IP from the command line he can use wget:


wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

and i thought this section was for newbies o.O

Total-MAdMaN 10-14-2008 04:59 PM

Quote:

Originally Posted by paperbag (Post 3310141)
and i thought this section was for newbies

It's for newbies to ask questions. More experienced users will answer them. Depending on the question, the answer may be simple or complex (or both).

onebuck 10-14-2008 09:11 PM

Hi,
Quote:

Originally Posted by Vit77 (Post 3309780)
It's sort of new utility with some new possibilities.
In general, it could work as a replacement for a majority of different Unix network commands.

<snip>

'ip tool' has been around for quite some time. It's just that a lot of new people don't use it.
Code:

excerpt from 'man ip'
      ip - show / manipulate routing, devices, policy routing and tunnels

SYNOPSIS
      ip [ OPTIONS ] OBJECT { COMMAND | help }

      OBJECT := { link | addr | route | rule | neigh | tunnel | maddr |
              mroute | monitor }

      OPTIONS := { -V[ersion] | -s[tatistics] | -r[esolve] | -f[amily] { inet
              | inet6 | ipx | dnet | link } | -o[neline] }

      ip link set DEVICE { up | down | arp { on | off } |
              promisc { on | off } |
              allmulti { on | off } |
              dynamic { on | off } |
              multicast { on | off } |
              txqueuelen PACKETS |
              name NEWNAME |
              address LLADDR | broadcast LLADDR |
              mtu MTU } ...

HISTORY
      ip was written by Alexey N. Kuznetsov and added in Linux 2.2.

The use of the 'ip tool' can be very powerful to the user. One needs to read the 'man 'ip' to get a better understanding.

Vit77 10-15-2008 12:47 AM

Quote:

Originally Posted by ritam_bkp (Post 3310009)
this "ip" command does not work 4 me??

This command should be run with root priviledges. So, you can run it as
Code:

sudo ip addr show
It is part of the iproute2 package (Advanced IP routing and network device configuration tools​). AFAIK, it has to work in Ubuntu by default.

ta0kira 10-17-2008 02:26 AM

Quote:

Originally Posted by ncsuapex (Post 3310011)
If he's trying to get his external IP from the command line he can use wget:


wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

Not all network connections lead to the internet, and even if a connection does, the IP address used to connect to the server you reference may or may not be masked by a firewall. For example, a wireless router will generally have a WAN address while giving out LAN addresses to the connected machines.
ta0kira


All times are GMT -5. The time now is 11:04 AM.