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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
08-05-2008, 02:49 PM
|
#1
|
Member
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63
Rep:
|
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!
|
|
|
08-05-2008, 02:55 PM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
08-05-2008, 04:22 PM
|
#3
|
Member
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208
Rep:
|
Quote:
Originally Posted by Nemus
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.
|
|
|
08-05-2008, 05:02 PM
|
#4
|
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Rep: 
|
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.)
|
|
|
08-06-2008, 02:10 AM
|
#5
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
farslayer, the point is these devices are on the same (presumed L2) switch so no routers are involved at all.
|
|
|
08-06-2008, 10:42 PM
|
#6
|
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Rep: 
|
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.
|
|
|
08-07-2008, 02:51 AM
|
#7
|
Member
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63
Original Poster
Rep:
|
Quote:
Originally Posted by farslayer
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 05:39 PM.
|
|
|
08-07-2008, 09:42 AM
|
#8
|
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Rep: 
|
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 09:43 AM.
|
|
|
08-11-2008, 05:37 PM
|
#9
|
Member
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63
Original Poster
Rep:
|
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 ....
|
|
|
08-12-2008, 04:06 AM
|
#10
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
again, why not just add an eth0:1 to the box to put yourself on both subnets?
|
|
|
08-13-2008, 12:10 AM
|
#11
|
Member
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63
Original Poster
Rep:
|
Quote:
Originally Posted by acid_kewpie
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.
|
|
|
01-25-2010, 01:03 PM
|
#12
|
LQ Newbie
Registered: Jan 2010
Posts: 2
Rep:
|
Quote:
Originally Posted by Nemus
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?
|
|
|
01-25-2010, 01:30 PM
|
#13
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
01-26-2010, 09:22 AM
|
#14
|
LQ Newbie
Registered: Jan 2010
Posts: 2
Rep:
|
Quote:
Originally Posted by acid_kewpie
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?
|
|
|
12-07-2014, 09:46 PM
|
#15
|
LQ Newbie
Registered: Dec 2014
Posts: 2
Rep: 
|
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  4:E5:F6 "ssh root@IP"
mac2ip B2:C3  4 "vncviewer IP:1"
mac2ip A1:B2:C3  4: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.
|
All times are GMT -5. The time now is 11:51 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|