Hints and Tips Topic
   >  Changing the Hostname
   >  Finding your IP & Mac Address
   >  Creating Users and Groups
   >  Running Scripts at Startup
   >  Network Interface Configuration
   >  Changing the Grub Default Option

 

Finding your IP and Mac Address

Finding the IP and Mac Address on a Linux PC

In order to display information about the interfaces attached to your Linux PC, simply type the following from the command line:

$ ifconfig

The output should look something like the following:

$ ifconfig
eth0   Link encap:Ethernet  HWaddr 1a:f0:22:05:c6:ea  
          inet addr:192.120.1.2   Bcast:192.120.1.255  Mask:255.255.255.0
          inet6 addr: ec62::11b9:30ff:fc12:d2e3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6705 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10556 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000 
          RX bytes:1021086 (1.0 MB)  TX bytes:14611639 (14.6 MB)
          Interrupt:41 

lo       Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:226 errors:0 dropped:0 overruns:0 frame:0
          TX packets:226 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:169929 (169.9 KB)  TX bytes:169929 (169.9 KB)

This is showing two interfaces on this computer:

.. the localhost loopback interface, [is] used by applications on your PC to connect to other services on your machine .. If this interface is down or blocked, then pretty much nothing will work

  • eth0 : this is the computer's (single) ethernet adaptor and is (here) attached to a wired cable leading to a router and - from there - out onto the internet. If there were two ethernet adaptors, the second one would have it's own entry, listed as eth1. You can see that this interface is "UP" and "RUNNING" but if this interface was down or blocked, then this computer would not be able to contact other computers on it's local network or the internet

  • lo : this is the localhost loopback interface, used by applications on your PC to connect to other services on your machine (-i.e. the messages appear to go out of your PC and loopback around to it). If this interface is down or blocked, then pretty much nothing will work. This is referred to on all Linux PCs by the standard IP address 127.0.0.1

In the ifconfig output, the internet connection (eth0) is the entry that you need to choose to get the IP and Mac Address. The example above, these have been highlighted:

  • The Mac Address is "1a:f0:22:05:c6:ea"
  • The IP Address is "192.120.1.2"

Finding the IP and Mac Address on a Windows PC

The equivalent command to ifconfig on a Windows PC is only one letter different:

C:> ipconfig /all

The ipconfig output should look something like the following:

C:> ipconfig /all

Windows IP Configuration

        Host Name  . . . . . . . . . . . . . : myPC
        Primary Dns Suffix  . . . . . . . :
        Node Type  . . . . . . . . . . . . . : Hybrid
        IP Routing Enabled . . . . . . . : No
        WINS Proxy Enabled . . . . . . : No
        DNS Suffix Search List. . . . . : dlink.com

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : dlink.com
        Description . . . . . . . . . . . . . . . . . : Realtek RTL8111E Family Fast Ethernet NIC
        Physical Address. . . . . . . . . . . . . : 1A-F0-22-05-C6-EA
        Dhcp Enabled . . . . . . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . . : Yes
        IP Address  . . . . . . . . . . . . . . . . . : 192.120.1.2>
        Subnet Mask. . . . . . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . . . . . : 192.120.1.1
        DHCP Server. . . . . . . . . . . . . . . . : 192.120.1.1
        DNS Servers . . . . . . . . . . . . . . . . : 192.120.1.1
        Lease Obtained. . . . . . . . . . . . . . : 06 February 2011 12:53:15
        Lease Expires . . . . . . . . . . . . . . . : 07 February 2011 12:53:15

HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button