9

Is it possible to connect remote system using mac-address in Ubuntu? I don't want to use IP address. Both systems are in same LAN.

  • using what protocol? – Maythux Jul 3 '15 at 8:47
  • using ssh @Maythux – d a i s y Jul 3 '15 at 9:09
  • Would you consider using the hostname instead of the MAC? you can "ssh username@hostname.local" – Katu Jul 3 '15 at 11:34
  • If you noticed, I'd said 'actually i want to do clean installation of ubuntu remotely. i read the answers but i am not getting the point of how to connect machine remotely and this is how i came to this question' @katutxakurra – d a i s y Jul 3 '15 at 11:42
6

From commlineFu:

connect via ssh using mac address Instead of looking for the right ip address, just pick whatever address you like and set a static ip mapping.

sudo arp -s 192.168.1.200  00:35:cf:56:b2:2g temp && ssh root@192.168.1.200

Another command:

ssh root@`for ((i=1; i<=255; i++));do arp -a 192.168.1.$i; done | grep 00:35:cf:56:b2:2g | awk '{print $2}' | sed -e 's/(//' -e 's/)//'`

then all you have to change the MAC and choose any IP you wish to use and change root to a valid user

Note: Those commands is just a hack an in really they are using the IP itself not the MAC.

Example using second command:

My LAN IP range is 10.1.1.* .The MAC of server want to connect to is 00:15:17:5f:XX:XX . The user on the host machine is called maythux

So the command will be:

ssh maythux@`for ((i=1; i<=20; i++));do arp -a 10.1.1.$i; done | grep 00:15:17:5f:XX:XX | awk '{print $2}' | sed -e 's/(//' -e 's/)//'`

Note i make for loop to 20 just for timing and i already know ip is less than 20, in case you dont range so keep it to 255.

And boom I'm prompted for password of user maythux in the host pc


TIP:

Instead you can normally use SSH with using IP, if you don't know the IP of some systems you can get it from the MAC, take a look for my question List all MAC addresses and their associated IP addresses in my local network (LAN) , you'll find many answers how to get an IP knowing its MAC

  • I am not getting anything with second command. maybe due to i don't have complete knowledge of ubuntu. still i will try. hope it will work @Maythux – d a i s y Jul 3 '15 at 9:21
  • I'll list down example wait me – Maythux Jul 3 '15 at 9:21
  • actually i want to do clean installation of ubuntu remotely. i read the answers but i am not getting the point of how to connect machine remotely and this is how i came to this question. – d a i s y Jul 3 '15 at 9:25
  • But why to use MAC, instead use IP it's much slick. Indeed those command above is just a hack and in really they are using IP not MAC in backend – Maythux Jul 3 '15 at 9:27
  • How would i get ip address if i am going to install os? – d a i s y Jul 3 '15 at 9:37
0

Don't know what exactly is the use case of yours. You can try this link. From the developer of the script,

Examples:

      mac2ip A1:B2:C3:D4:E5:F6 \"ssh root@IP\""
      mac2ip B2:C3:D4 \"vncviewer IP:1\""
      mac2ip A1:B2:C3:D4:E5:F6 \"krdc IP\""
      mac2ip x x (will give you a MAC list.)"
      "Note:     depends on ping, ifconfig and arp."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.