Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-25-2008, 03:13 PM   #1
LQ Newbie
Registered: Nov 2006
Posts: 16

Rep: Reputation: 0
get localhost IP address from Linux kernel


I would like to get the localhost IP address from within the Linux kernel module loaded.(not the but the IP address assigned to the eth interface)

any way to go about this?

Old 09-25-2008, 03:20 PM   #2
Senior Member
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 83
Well, if you mean your IP address on your local network:

dave@dave:~$ ifconfig
will return all current network interfaces, with all relevant info.


dave@dave:~$ ifconfig | grep inet
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::219:d2ff:fe88:b87f/64 Scope:Link
is more specific, and for me the relevant line in the output is the third line, with the IP address!

Hope that helps.
Old 02-17-2011, 02:15 AM   #3
LQ Newbie
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
I realize that this thread is quite old, but I will update it with my findings for future visitors.

Now I have no idea wether this is safe or not, but it is at least one way of finding your local IP from kernel-space:



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linking ip address to localhost av.dubey Linux - Newbie 15 02-19-2008 11:27 PM
Message from syslogd@localhost localhost kernel: Disabling IRQ #21 ylts Linux - Hardware 0 02-26-2005 09:01 AM
//localhost address problem eddi Linux - Networking 2 02-04-2004 12:55 PM
localhost internet address pete_bogg Red Hat 2 10-31-2003 08:00 PM
Could not look up internet address for localhost? Rv5 Red Hat 4 09-29-2003 09:02 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration