IP address inventory and management could be part of your regular task. This may include MAC address inventory for network cards and host identification.
Here's a quick blog entry on retrieving MAC Address the network card of each host inside your local broadcast network.
To retrieve and fetch the MAC Address of a particular host's IP address
# arping host.ip.address.here
# arping x.x.x.x
Just make sure that the target host is part of your local subnet or local broadcast network to avoid getting the MAC address from the middle router that is in action of the route stuff. This arping command can also be used to retrieve MAC address from multiple host to fetch multiple host from your local network via shell script.
Here's a generic and basic shell script to arping multiple hosts. The below shell code would arping hosts that has IP address between 192.168.0.2 and 192.168.0.254 .
# cat multiple.sh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#/bin/bash
for ((i=2; i<=254;i=i+1 ));
do
arping -c 1 192.168.0.$i
done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then, simply call the script to filter only the MAC address like so
# ./multiple.sh | grep "reply from"
Result:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unicast reply from 83.x.x.x [00:02:A5:EC:00:8B] 0.705ms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IP address and the MAC address filter can also be applied similarly like so
# ./multiple.sh | grep "reply from" | awk '{print $4,$5}'
Alternatively, you can use linux nmap command to retrieve MAC address of a particular host with known IP address as shown below
# nmap x.x.x.x
# nmap enter.ip.address.here
Nmap also supports multiple IP address and subnet blocks as input parameters. This basically means that nmap linux tool can list out MAC address of multiple hosts by feeding nmap with multiple host or network block inputs like so
# nmap 192.168.0.0/24
And a lot more. Enjoy.
Related Readings:
Other Interesting Pings
More of NMap Port Scanning
MAC Address Packet Filtering Using Iptables
Ping IP Address Subnet and Multiple Hosts Ping
Linux Ping Command Explained
Install Fping Linux Tool
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2008
(2301)
-
▼
January
(49)
- HowTo: Brasero
- HowTo: ISOs Management for Fedora
- HowTo: Install Nmap with GUI FrontEnd
- HowTo: Create and Manage Genealogy Family Tree via...
- HowTo: Install KFTPGrabber FTP Client
- HowTo: Install FileZilla 3 on Fedora 8
- HowTo: Be Alerted via Popups When Monitoring Log F...
- HowTo: Mount Windows Drive From Linux GUI
- HowTo: Delete Files With 0K Filesize Recursively
- HowTo: Changing Interface's MTU Size
- HowTo: Create Vanishing Virtual Drive
- HowTo: Install Identity.pub Into Remote Machines
- HowTo: Check and Mark Bad Block Of Hard Disk
- HowTo: Install Linux Hardware Browser
- HowTo: Basic RPM Package Queries And Usage
- HowTo: Rebuild Locked Out RPM Database
- HowTo: Display RPM Packages Installed Last Month
- HowTo: Display and List Out All Package Files Rece...
- HowTo: Identify Source Package Name Of A File or F...
- HowTo: Delete Extra Spaces Between Words From Files
- HowTo: Find Hidden Directory Folders Recursively
- HowTo: Create Hidden Directory Folder
- HowTo: Print Only Lines of Text File with N charac...
- HowTo: Sort Files by FileSize and What Else?
- HowTo: Squeezed Out Multiple Lines From Text File
- HowTo: Prevent Binary Execution From Mounted Device
- HowTo: Determine Domain's Expiration Date From Lin...
- HowTo: Create and Overwrite Existing Alias
- HowTo: Get MAC Address of PCs Around
- HowTo: List Out Hidden Files and Hidden Directory ...
- HowTo: Identify Valid Login Shells
- HowTo: Deny User from Logging Into Your System
- HowTo: Remove Tabs From Text Files Completely
- HowTo: Convert Tabs In Each File To Spaces
- HowTo: Install and Say Cheese
- HowTo: Install HomeBank and Manage Personal & ...
- HowTo: Install Mind-Mapping LabyRinth Tool
- HowTo: Install VMWare Server on Fedora 8
- HowTo: Install VMWare Workstation on Fedora 8
- HowTo: Virtual PCLinux 2007 via VirtualBox over Fe...
- HowTo: Enable PortMap on Fedora 8
- HowTo: Linux Hardware Lister Tool - LsHw
- HowTo: Install Bandwidth Shaper - Trickle on Fedora
- HowTo: VnStat Long-Term Traffic Monitoring via CLI
- HowTo: Install NetSpeed Traffic Monitoring Applet
- HowTo: Install IPTraff LAN Monitoring Tool
- HowTo: Install Ibmonitor Interface Bandwidth Monitor
- HowTo: Install IfTop Bandwidth Monitoring Tool
- HowTo: Fedora WordPress Installation
-
▼
January
(49)
Thursday, January 17, 2008
HowTo: Get MAC Address of PCs Around
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment