Skip to main content

To determine the MAC address of a remote device:


Hi Friends...
Some time we face issues like we are not able to connect to remote server, or server is not reachable. In that case we may require its mac address for further trouble shooting..

Every device on a TCP/IP network has a unique number assigned to it called the MAC (Media Access Control) address.

Your computer uses a service called ARP (Address Resolution Protocol) to resolve and track the TCP/IP and MAC address of the remote devices that you're communicating with. This information is handy for doing semi-low level network troubleshooting.
 It can also be used for granting or denying permissions to a network segment or device on that network. 

To determine the MAC address of a remote device:
  • Open the MS-DOS prompt (From the Run... command, type "CMD" and press Enter).
  • Ping a remote device that you want to find the MAC address (for example: PING 192.168.0.1).
  • Type "ARP -A", and press Enter.

C:\WINDOWS>arp -aInterface: 192.168.1.100 --- 0x10004 Internet Address Physical Address Type 192.168.1.1 aa-fb-c8-34-da-7a dynamic
There is one more Command to get the MAC address:-

nbtstat -n <remote hostname>
Host not found.

getmac /s remote_computer name or IP /u username /p password
ERROR: The RPC server is unavailable.

example:-

C:\Windows\System32>nbtstat -a 10.50.27.29

Local Area Connection 2:

Node IpAddress: [10.91.4.168] Scope Id: []
           NetBIOS Remote Machine Name Table

       Name               Type         Status

    ---------------------------------------------

    WIN-AC69OP04CTJ<00>  UNIQUE      Registered

    WORKGROUP      <00>  GROUP       Registered

    WIN-AC69OP04CTJ<20>  UNIQUE      Registered

    MAC Address = A4-1F-72-AA-F2-1B
 Using getmac:-

C:\Windows\System32>getmac  /s <IP> /u username /p password


Physical Address    Transport Name

=================== ==========================================================

A4-1F-72-AA-F2-1C   \Device\Tcpip_{C35FF51C-5A5C-4018-A00B-BA0DCF859FE9}

A4-1F-72-AA-F2-1B   \Device\Tcpip_{804C7138-F735-450E-9AA7-C46966FE0FD6}
If you do not want to specify the password, you can skip /p parameter. You will be prompted to enter the password and the command execution will take place after that.

Using getmac we can only get MAC address for windows machines. For linux use arp.

Comments

Popular posts from this blog

20 perl programming tips

1. List all Installed Perl Modules from Unix Command Line Get a list of all installed perl modules as shown below. $ perl -MFile::Find=find -MFile::Spec::Functions -Tlw -e 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC' /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/Filter.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/LinkExtor.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/PullParser.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/Parser.pm /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/HTML/TokeParser.pm ..... In the above example, File::Find  and  File::Spec::Functions  module are used to list all installed modules. -M option  loads the module. It executes  use module  before executing the script -T option  enables taint checking, which instructs perl to keep track of data from the user and avoid doing anything insecure w...

Perl and Excel: How to Read, Write, Parse Excel Files using Perl

If you want to manipulate excel files programmatically, you can use Perl Spreadsheet module, which provides an object interface that makes it easier to create and parse Excel files. Install Spreadsheet WriteExcel Module Method 1: Standard install using make Download the zipped tar file of  Spreadsheet-ParseExcel  and  Spreadsheet-WriteExcel  from cpan. Untar and unzip the module as follows: tar -zxvf Spreadsheet-WriteExcel.tar.gz cd to the directory the tar creates. Execute the steps below to to install the Spreadsheet-WriteExcel module. perl Makefile.PL make make test make install Use the above procedure to install Spreadsheet-ParseExcel also. Method 2: CPAN.pm install If you have CPAN.pm configured you can install the module as follows: perl -MCPAN -e 'install "Spreadsheet::WriteExcel"' perl -MCPAN -e 'install "Spreadsheet::ParseExcel"' For additional installation help refer to: How To Install Perl Modules Manually and Using ...

How to Connect to MySQL from Perl

How do I connect to a MySQL database from a perl program? use perl DBI module to connect to a MySQL database as explained below. If you don’t have perl DBI and DBD::mysql module installed, install perl module using cpan as we discussed earlier. # perl -MCPAN -e shell cpan> install DBI cpan> install DBD::mysql On a very high level, you’ll have to do the following three steps to connect to a MySQL database and get data. 1. Connect to the MySQL Database In the DBI module, you’ll use the connect function as shown below. $dbc = DBI->connect($source, $username, $password) DBI->connect function takes the following three arguments: $source – This is in the format of “DBI:mysql:[database]:[hostname]”. Replace the [database] and [hostname] with values from your system. In the example shown below, it is connecting to the database called “mycompany” that is running on the localhost. $username – The username that is used to connect to the MySQL database. $pass...