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! |
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.
|
Quote:
|
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.) |
farslayer, the point is these devices are on the same (presumed L2) switch so no routers are involved at all.
|
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. |
Quote:
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. |
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 |
Un successful
Code:
arp -s 192.168.0.77 00:0C:42:13:B1:7D Code:
arp Code:
ssh admin@192.168.0.77 |
again, why not just add an eth0:1 to the box to put yourself on both subnets?
|
Quote:
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. |
Quote:
|
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.
|
Quote:
|
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. |