LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-13-2008, 11:02 AM   #1
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Rep: Reputation: 0
How to get a list of IP addresses currently on the network?


I am using DHCP on my home network. There could be as many as 5 computers logged in at any given time. Their IP addresses change depending on the sequence they log in.
I want to be able to connect to them from any of them (some wired, some wireless) and share files by issuing a mount command for the appropriate shared drive.
My question is how to get the IP of each computer when I only know the names of the computers. Pinging the computer name succeeds, but it does not give the IP.
In other words I am looking for a Linux command that will come back with a list of IP's with their corresponding computer names so I can issue the right mount command. I would like to issue this command from a Linux terminal, but would also be happy to issue it from a Windows XP station.

Right now I can only do this by logging into my router, a practice I would rather not follow.
 
Old 12-13-2008, 11:14 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
you could try
nmap -sP 10.0.0.0/24
 
Old 12-13-2008, 01:05 PM   #3
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Original Poster
Rep: Reputation: 0
Thank repo.
I ran nmap -sP 192.168.1.0/24
and got a list of only the wireless devices, not the wired ones. Also I did not get the all important computer names so I could identify which IP goes with which computer.
Any suggestions?
BTW I am running Linpus Lite on the Acer Aspire One.
 
Old 12-13-2008, 01:26 PM   #4
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
Hi puszikam

Can you please elaborate on this

Quote:
Pinging the computer name succeeds, but it does not give the IP.
Perhaps list the commands you issued for that, and their output?
 
Old 12-13-2008, 02:11 PM   #5
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Original Poster
Rep: Reputation: 0
The following list will show that 192.168.1.4 and 5 were also logged onto the network, but the nmap command did not show them.
Also at this moment emachine = 192.168.1.4 and mimi = 192.168.1.5
I want a list that will show that emachine and mimi are logged on and what their IP's are.
I hope this makes it clear.
Thanks for the help.


[user@localhost ~]$ nmap -sP 192.168.1.0/24

Starting Nmap 4.52 ( http://insecure.org ) at 2008-12-13 15:02 EST
Host 192.168.1.1 appears to be up.
Host 192.168.1.2 appears to be up.
Host 192.168.1.3 appears to be up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 6.791 seconds
[user@localhost ~]$ ping 192.168.1.4
PING 192.168.1.4 (192.168.1.4) 56(84) bytes of data.
64 bytes from 192.168.1.4: icmp_seq=1 ttl=128 time=1.83 ms
64 bytes from 192.168.1.4: icmp_seq=2 ttl=128 time=1.11 ms
64 bytes from 192.168.1.4: icmp_seq=3 ttl=128 time=1.14 ms
64 bytes from 192.168.1.4: icmp_seq=4 ttl=128 time=1.10 ms

--- 192.168.1.4 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3024ms
rtt min/avg/max/mdev = 1.107/1.300/1.834/0.310 ms
[user@localhost ~]$ ping 192.168.1.5
PING 192.168.1.5 (192.168.1.5) 56(84) bytes of data.
64 bytes from 192.168.1.5: icmp_seq=1 ttl=128 time=1.09 ms
64 bytes from 192.168.1.5: icmp_seq=2 ttl=128 time=1.13 ms
64 bytes from 192.168.1.5: icmp_seq=3 ttl=128 time=1.63 ms
64 bytes from 192.168.1.5: icmp_seq=4 ttl=128 time=1.13 ms

--- 192.168.1.5 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2998ms
rtt min/avg/max/mdev = 1.098/1.250/1.638/0.224 ms
[user@localhost ~]$ ping emachine
PING emachine (67.63.55.3) 56(84) bytes of data.
64 bytes from 67.63.55.3: icmp_seq=1 ttl=243 time=44.4 ms
64 bytes from 67.63.55.3: icmp_seq=2 ttl=243 time=44.7 ms
64 bytes from 67.63.55.3: icmp_seq=3 ttl=243 time=44.4 ms

--- emachine ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 2998ms
rtt min/avg/max/mdev = 44.444/44.537/44.722/0.276 ms
[user@localhost ~]$ ping mimi
PING mimi (67.63.55.3) 56(84) bytes of data.
64 bytes from 67.63.55.3: icmp_seq=1 ttl=243 time=43.1 ms
64 bytes from 67.63.55.3: icmp_seq=2 ttl=243 time=46.4 ms
64 bytes from 67.63.55.3: icmp_seq=3 ttl=243 time=51.2 ms
64 bytes from 67.63.55.3: icmp_seq=4 ttl=243 time=43.1 ms

--- mimi ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2998ms
rtt min/avg/max/mdev = 43.144/45.993/51.219/3.303 ms
[user@localhost ~]$
 
Old 12-13-2008, 02:16 PM   #6
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
Quote:
PING emachine (67.63.55.3)
PING mimi (67.63.55.3)
That explains it all.

Your `emachine' and `mimi' are on a different subnet, on a public, class A IP address even, both have the same IP incidentally (check your /etc/hosts file)
 
Old 12-13-2008, 02:53 PM   #7
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Original Poster
Rep: Reputation: 0
I am not sure what this explains. I really don't care weather these computers show up on the nmap list or not. I just want to know what the current IP is for each of the computers with their names. In other words what is the IP for emachime and for mimi and all the others that might be on so I can mount them.

My /etc/hosts file contains no entries for any computer on the network. If I hardcode anything into it it might become wrong any time.
 
Old 12-13-2008, 03:15 PM   #8
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
there must be a dns entry somewhere, in order to give the ip of emachime and mimi
are thy all behind the router, in your lan?
Is the router giving out public ip's?if yes, why?
 
Old 12-13-2008, 03:42 PM   #9
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Original Poster
Rep: Reputation: 0
You are starting to get above my "expertise". My router has two wired connections (emachine and mimi) and several wireless ones as needed. I have done nothing other than enabled (and secured) my wireless network. Once security is met the wireless devices can connect without my doing anything special. You lost me with your question on public IP's. I have not done anything sophisticated, did not define any IP's anywhere. Whatever is happening is being done by the router (Netgear Rangemax).
I appreciate your trying to unscramble my situation.
 
Old 12-13-2008, 04:16 PM   #10
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Assuming your computers are all running linux there is an easier way out. You can use pseudo static addresses. You still use your DHCP router only you set your /eth0 up to run static. This way each machine always gets the same IP address and you alway know it. Here is my /etc/sysconfig/network/devices/eth0

Quote:
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:15:f2:44:8d:aa
IPV6INIT=no
IPV6_AUTOCONF=no
ONBOOT=yes
TYPE=Ethernet
PEERDNS=no
USERCTL=no
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS2=4.2.2.3
SEARCH=localdomain
DNS3=24.217.0.55
DNS1=4.2.2.2
NM_CONTROLLED=no
IF you have wireless devices that only visit occasionally start you static addresses from the top of the range down. That way you will always know the address of the visiting machine (generally address are assigned from the bottom up).
 
Old 12-13-2008, 05:14 PM   #11
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Original Poster
Rep: Reputation: 0
One of the wired devices is always Windows, the other is dual booting between Windows and Linux (PCLinuxOS). The wireless ones are also a mixed bag between Windows and different flavors of Linux. The one I am most interested in being able to have access to Windows shares is Linpus Lite (a subset of Fedora 8) with very limited flexibility in doing anything but the most basic things.
 
Old 12-13-2008, 07:11 PM   #12
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I don't really want to get involved in this thread, but has anyone paid any attention to the fact that emachine and mimi have the same IP (as pointed out previously)?

Quote:
PING emachine (67.63.55.3) 56(84) bytes of data.

PING mimi (67.63.55.3) 56(84) bytes of data.
That doesn't make any sense.

Whatever you are trying to do is going to be problematic until you sort out the duplicated IP (note that as far as networks are concerned, emachine and mimi are the same machine).

Aside from that, try some DNS commands.

First I would try is

"dig mimi.example.com" (I think you need a fully qualified domain name rather than just mimi).

If you router is handling the DHCP, you may be out of luck - a lot of stuff that works for a full dhcp installation may not be supported.

Another thought would be to see if your dhcp server allows for allocating IP's to defined MAC addresses, so that every time a particular machine requests an IP it gets the same one, and you can use IPs rather than hostnames.

Last edited by billymayday; 12-13-2008 at 07:35 PM.
 
Old 12-13-2008, 08:16 PM   #13
puszikam
LQ Newbie
 
Registered: Nov 2008
Location: New Jersey
Distribution: PCLinuxOS and Linpus Lite
Posts: 13

Original Poster
Rep: Reputation: 0
While emachine and mimi appear to have the same IP, within my lan they are 192.168.1.4 and 192.168.1.5 respectively and it works perfectly, I can mount these IP's on the machines, as long as I know what they are for each machine.
I tried the suggested command but "dig" is an unknown command on my machine.
About allocating IP's to MAC addresses I am lost. How would you do it?
In the current router settings I have:
Internet address get dynamically from ISP
DNS address get dynamically from ISP
Router MAC address use default MAC address

Keep in mind that any change I make to these should not effect my ability to access one Windows machines from another Windows machine in Network Neighborhood, which works flawlessly now based on computer names (i.e. host names).

I guess all I need is the ability to determine what host name goes with what address (192.168.1.x) on the lan (without putting it in the /etc/hosts file).
 
Old 12-13-2008, 08:23 PM   #14
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
While I have not done it in a while (dropped windows years ago) you can assign IP address on windows in a similar fashion as I described above for Linux.
 
Old 12-13-2008, 11:28 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Are you just wanting to mount share drives, and are you running samba? If so, try some of the samba tools, try

smbclient -L localhost

and see what it throws up.
 
  


Reply



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
Doubt in network addresses sunils1973 Linux - Networking 4 09-09-2007 12:01 AM
print list of email addresses from .dbx directories esteeven Linux - General 1 05-04-2007 02:51 PM
Importing List of Addresses into IP Tables kaplan71 Linux - Security 9 12-08-2006 03:48 PM
List IP addresses stefaandk Linux - Newbie 2 07-26-2005 09:02 PM
Long list of addresses & Calls when I log in wartstew Linux - General 0 02-09-2005 09:21 PM

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

All times are GMT -5. The time now is 09:35 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