LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


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

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


Hi,

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

any way to go about this?

-Alphy
 
Old 09-25-2008, 02:20 PM   #2
irishbitte
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: 88
Well, if you mean your IP address on your local network:

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

This:

Code:
dave@dave:~$ ifconfig | grep inet
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          inet addr:192.168.1.10  Bcast:255.255.255.255  Mask:255.255.255.0
          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, 01:15 AM   #3
wkz
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:

http://waldekranz.com/log/?p=6
 
  


Reply

Tags
getaddrinfo



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 10:27 PM
Message from syslogd@localhost localhost kernel: Disabling IRQ #21 ylts Linux - Hardware 0 02-26-2005 08:01 AM
//localhost address problem eddi Linux - Networking 2 02-04-2004 11:55 AM
localhost internet address pete_bogg Red Hat 2 10-31-2003 07:00 PM
Could not look up internet address for localhost? Rv5 Red Hat 4 09-29-2003 08:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

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