Ubuntu: Identifying correct connection device when reading ifconfig output



Question:

I'm trying to get the mac address of my computer.

I've run ifconfig like the person in this question, and I get information about eth0, eth1 and lo.

The HWaddr of eth0 and eth1 are different, so I need to work out which one I should look at.

How do I determine which one I should be looking at?

(Normally I'd paste in the output of ifconfig, but I suspect some of the output is private)


Solution:1

I assume you are on a desktop with two Ethernet controllers? And that you need to register a mac address to connect to a particular network where addresses are monitored?

Each Ethernet has its own MAC address. You have two options:

  1. Plug in a cable into one of them on a network you can use. And the run ifconfig a few times while using the net (run a YouTube video) you should see RX bytes increasing. (there must be a better way in the terminal?). Or outside the terminal, click the networking logo (near the clock) and then select Connection Information, this should tell you which Ethernet is now connected. Once you know which controller/port you can register that one.
  2. Register either one of them. Once it is registered if you can't connect, switch the Ethernet cable to the other port. (Just check you have two ports first!!)

I did number 2 at my work.


Solution:2

Generally, but not always, eth0 is wired ethernet and eth1 is wireless. You can see which is wireless with the terminal command:

iwconfig  

You will see something like:

eth0      no wireless extensions.    lo        no wireless extensions.    eth1  IEEE 802.11abgn  ESSID:"wireless"          Mode:Managed  Frequency:5.825 GHz  Access Point: XX:D7:19:41:54:ZZ           Bit Rate=144.4 Mb/s   Tx-Power=15 dBm           Retry  long limit:7   RTS thr:off   Fragment thr:off  

Be careful, the MAC address here is the address of the access point to which you are connected. Go back to ifconfig once you've determined which is wireless to confirm the MAC address of the device.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »