LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ssh using mac address (https://www.linuxquestions.org/questions/linux-software-2/ssh-using-mac-address-660674/)

Nemus 08-05-2008 01:49 PM

ssh using mac address
 
Does anyone known if it would be possible to setup a ssh connection using a Network Interface Cards MAC address instead of the IP address?

I need to ssh to devices that have different subnets than the box that I am on which are attached to the same switch.

thank you!

acid_kewpie 08-05-2008 01:55 PM

no, but it's simple to add an additional IP on an existing ethernet interface to get to it. "ifconfig eth0:1 1.2.3.4" and you can directly hit 1.2.3.5.

0.o 08-05-2008 03:22 PM

Quote:

Originally Posted by Nemus (Post 3237727)
Does anyone known if it would be possible to setup a ssh connection using a Network Interface Cards MAC address instead of the IP address?

I need to ssh to devices that have different subnets than the box that I am on which are attached to the same switch.

thank you!

You could probably set a static ARP entry and use the IP.

farslayer 08-05-2008 04:02 PM

the MAC address won't help you across subnets as you specified.

A MAC address is a Layer 2 component and doesn't cross layer 3 boundaries such as routers.

A router contains an arp cache table that tracks MAC addresses (layer 2) on each segment and translates IP addresses (layer 3) to the destination MAC addresses. (Yes this explanation is simplified.)

acid_kewpie 08-06-2008 01:10 AM

farslayer, the point is these devices are on the same (presumed L2) switch so no routers are involved at all.

farslayer 08-06-2008 09:42 PM

He stated they were in different subnets, that would imply a router has to be involved at some point.

Ahh I think I get it now.. (the light switch clicked on..) that's why the MAC address.

Static arp assignments then as 0.o suggested, should require no reconfiguration of the remote hosts.

Nemus 08-07-2008 01:51 AM

Quote:

Originally Posted by farslayer (Post 3239329)
He stated they were in different subnets, that would imply a router has to be involved at some point.

Ahh I think I get it now.. (the light switch clicked on..) that's why the MAC address.

Static arp assignments then as 0.o suggested, should require no reconfiguration of the remote hosts.

exactly!

The issue is that I want to script the process that I have to do manually.
I have to log in into each devices that comes with random ip address (a user configured device that has been returned for some reason. ) and collect info about the radio.

So I figured if I could ssh using a MAC address I could just do an arp -a see the mac. Then log in get the information I need and dump it to a database then just continue down the loop until all the devices are done.

I think there is a way to MAC telnet, but the davices have ssh as default.

Any ideas would be helpful.

Thank you.

farslayer 08-07-2008 08:42 AM

did you man arp yet on setting a static entry ?


Destination device

remotehost:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1a:a0:08:67:08
inet addr:10.10.10.15 Bcast:10.10.10.255 Mask:255.255.255.0


Code:

it-etch:~# arp
Address                  HWtype  HWaddress          Flags Mask            Iface
192.168.0.236            ether  00:0C:F1:AD:33:7D  C                    eth0
192.168.0.1              ether  00:03:D2:26:94:86  C                    eth0

it-etch:~# arp -s 192.168.0.253  00:1a:a0:08:67:08

it-etch:~# arp
Address                  HWtype  HWaddress          Flags Mask            Iface
192.168.0.253            ether  00:1a:a0:08:67:08  CM                    eth0
192.168.0.236            ether  00:0C:F1:AD:33:7D  C                    eth0
192.168.0.1              ether  00:03:D2:26:94:86  C                    eth0


it-etch:~$ ssh 192.168.0.253


Nemus 08-11-2008 04:37 PM

Un successful
 
Code:

arp -s 192.168.0.77 00:0C:42:13:B1:7D
Code:

arp
Address                  HWtype  HWaddress          Flags Mask            Iface
192.168.0.77            ether  00:0C:42:13:B1:7D  CM                    eth1

Code:

ssh admin@192.168.0.77
nothing happens ....

acid_kewpie 08-12-2008 03:06 AM

again, why not just add an eth0:1 to the box to put yourself on both subnets?

Nemus 08-12-2008 11:10 PM

Quote:

Originally Posted by acid_kewpie (Post 3244526)
again, why not just add an eth0:1 to the box to put yourself on both subnets?

because I need to script the process if at all possible

when you receive a device that could have any possible ip address on it

it becomes a pain in the butt to reconfigure eth:1 ever time and figure out what subnet its on. now times that by 300 devices that you plug in ever day.

mikrotik has a utility that lets you get inside of its devices with only using the mac address.

I would like to make such a utility.

bustaplz 01-25-2010 12:03 PM

Quote:

Originally Posted by Nemus (Post 3245474)
because I need to script the process if at all possible

when you receive a device that could have any possible ip address on it

it becomes a pain in the butt to reconfigure eth:1 ever time and figure out what subnet its on. now times that by 300 devices that you plug in ever day.

mikrotik has a utility that lets you get inside of its devices with only using the mac address.

I would like to make such a utility.

Sorry to bump an old thread. Came across this while Googling. I working on some MikroTik RB411's. I think I have a script worked out that will update the firmware and apply the configuration I want to multiple units, but I would have to connect via SSH in PuTTY using MAC Add to do it. Anyone got any ideas?

acid_kewpie 01-25-2010 12:30 PM

SSH is a TCP/IP protocol. you can't run it below this level. SSH servers listen to an IP address, not a mac address, so it just makes no sense.

bustaplz 01-26-2010 08:22 AM

Quote:

Originally Posted by acid_kewpie (Post 3840004)
SSH is a TCP/IP protocol. you can't run it below this level. SSH servers listen to an IP address, not a mac address, so it just makes no sense.

I see, consider me wiser. Are there any alternatives that work in the absence of TCP/IP, just for curiosity's sake?

JoeInNC 12-07-2014 08:46 PM

bash script solution
 
Found this thread several times in the last days
searching for a solution!
So for all who still need a solution get mac2ip from
https://sites.google.com/site/joergtinner/
-------------------------------------------------------
joe@CQ60:~$ mac2ip

Running programs with the MAC instead of the IP.

SYNTAX: mac2ip MAC "CMD"

MAC - is the Mac-Address (or distinctive[!] part)
you want to get substituted by the related IP.
CMD - is the command you want to execute. Please write
it in quotes and use "IP" instead of the IP.

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"
Tip: mac2ip x x (will give you a MAC list.)
Note: depends on ping, ifconfig and arp.
------------------------------------------------------
There is a block to edit in the script, if you need to
access some other subnets!

Works fine for me, Joe.


All times are GMT -5. The time now is 06:44 PM.