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 03 '15 at 08:47
-
using ssh @Maythux – d a i s y Jul 03 '15 at 09:09
-
Would you consider using the hostname instead of the MAC? you can "ssh username@hostname.local" – Katu Jul 03 '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 03 '15 at 11:42
2 Answers
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 03 '15 at 09: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 03 '15 at 09:25
-
-
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."

- 347
- 2
- 6
-
I think you have too many quotes, looks like you copy/pasted from the script. So for the 1st 3 commands, remove the last double quote. Also no need to escape the quotes that was just for the how to. It also appears you need to use lower case letters. – RobbieTheK Feb 24 '21 at 21:12