LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2008, 01:49 PM   #1
Nemus
Member
 
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63

Rep: Reputation: 15
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!
 
Old 08-05-2008, 01:55 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 08-05-2008, 03:22 PM   #3
0.o
Member
 
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208

Rep: Reputation: 35
Quote:
Originally Posted by Nemus View Post
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.
 
Old 08-05-2008, 04:02 PM   #4
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
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.)
 
Old 08-06-2008, 01:10 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
farslayer, the point is these devices are on the same (presumed L2) switch so no routers are involved at all.
 
Old 08-06-2008, 09:42 PM   #6
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
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.
 
Old 08-07-2008, 01:51 AM   #7
Nemus
Member
 
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by farslayer View Post
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.

Last edited by Nemus; 08-11-2008 at 04:39 PM.
 
Old 08-07-2008, 08:42 AM   #8
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
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

Last edited by farslayer; 08-07-2008 at 08:43 AM.
 
Old 08-11-2008, 04:37 PM   #9
Nemus
Member
 
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63

Original Poster
Rep: Reputation: 15
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 ....
 
Old 08-12-2008, 03:06 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
again, why not just add an eth0:1 to the box to put yourself on both subnets?
 
Old 08-12-2008, 11:10 PM   #11
Nemus
Member
 
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
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.
 
Old 01-25-2010, 12:03 PM   #12
bustaplz
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by Nemus View Post
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?
 
Old 01-25-2010, 12:30 PM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 01-26-2010, 08:22 AM   #14
bustaplz
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
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?
 
Old 12-07-2014, 08:46 PM   #15
JoeInNC
LQ Newbie
 
Registered: Dec 2014
Posts: 2

Rep: Reputation: Disabled
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:C34:E5:F6 "ssh root@IP"
mac2ip B2:C34 "vncviewer IP:1"
mac2ip A1:B2:C34: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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Single DHCP server ,to provide the ip address to a MAC address in two different subne alix123 Linux - Software 5 05-08-2007 11:16 PM
How to find an IP address from the MAC address of a remote machine ? jitz Linux - General 3 01-03-2006 07:55 AM
How to find IP address of a machine if I know their MAC Address dysenteryduke Linux - Networking 13 09-12-2005 10:21 AM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
DHCP Server MAC Address found, IP address not assigned wmburke Linux - Wireless Networking 17 11-17-2004 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration