LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   To find out my ip address (https://www.linuxquestions.org/questions/linux-newbie-8/to-find-out-my-ip-address-864911/)

janeesh 02-24-2011 11:29 PM

To find out my ip address
 
Hi,
i am actually connected to a computer that is connected to a LAN.
I want to find out my ip address.
i have checked 'ifconfig' its not working.
Plz let me know any other command is there

ceantuco 02-24-2011 11:31 PM

Hello,

can you give us more information? what do you get when you type ifconfig. please paste your results here. also, what distro are you using?

soplin 02-24-2011 11:40 PM

ifconfig may not be accessible directly or not at all. check sh /usr/sbin/ifconfig or sh /usr/ifconfig depending on the setup. If you want the public IP address, http://www.whatismyip.com/ .
Sometimes you can ls /var/log/samba and see if the ip shows up in there as a log.
hostname -i

EDDY1 02-25-2011 12:06 AM

Do you have an icon that shows that you're connected? If so then right click on it and select connection information.

LlNUX 02-25-2011 12:07 AM

You and also use perl to find you external public IP address.

mayursingru 02-25-2011 03:15 AM

try this
/sbin/ip addr

slack-fu 02-25-2011 04:22 AM

You need to have root privileges..

janeesh 02-27-2011 11:41 PM

Quote:

Originally Posted by mayursingru (Post 4270646)
try this
/sbin/ip addr

the below comment is working.
Thanx..

plmiles 04-07-2012 08:52 PM

Unless you are using a 56K modem or an older DSL modem, ifconfig will tell you your LAN address, not your internet IP address.

Certain websites will return your IP address. Use one of these BASH commands:
curl ifconfig.me
curl echoip.com; echo

or you can can use a browser with one of these URLs:
ifconfig.me, echoip.com, whatismyip.com, http://checkip.dyndns.com/, http://ip-me.co.uk

or find the LAN address of your modem or router with this BASH command:
arp -n
Type the numeric IP into your browser to get to an information page
You might need a password or modem access code, printed on the DSL modem

onebuck 04-08-2012 09:35 AM

Member response
 
Hi,

Quote:

Originally Posted by slack-fu (Post 4270696)
You need to have root privileges..

Not really;
Quote:

$ /sbin/ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2488 errors:0 dropped:0 overruns:0 frame:0
TX packets:2488 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:227343 (222.0 KiB) TX bytes:227343 (222.0 KiB)

wlan0 Link encap:Ethernet HWaddr 00:1b:b1:f4:20:9d
inet addr:192.168.1.26 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21b:b1ff:fef4:209d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6244442 errors:0 dropped:6 overruns:0 frame:0
TX packets:2638520 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5487938741 (5.1 GiB) TX bytes:309104926 (294.7 MiB)
'/sbin' is not always in the 'users' PATH. So absolute direction will work. Sure you may not be able to make system changes without 'sudo' or 'su -'.

Roken 04-08-2012 10:23 AM

Quote:

Originally Posted by LlNUX (Post 4270511)
You and also use perl to find you external public IP address.

or bash:

Code:

#!/bin/bash

wget -qO - -U Firefox/3.0.15 http://whatsmyip.net | grep "Your IP is" | sed 's/.*Your IP is: \(.*\)<.*>/\1/'



All times are GMT -5. The time now is 01:19 AM.