4
I have a machine that connects to a corporate network over VPN. When I connect to the VPN, it always gives me a different hostname and ip address. The hostname is always remote-[last octet of ip address]. Whenever I want to SSH into my machine, I first have to run "hostname -A" to see what the hostname is. The problem is, I don't always know what my hostname is when I need to access the computer. (If I go to where the computer is physically located to find the hostname, it defeats my need to SSH.)
Could I use SSH and try each hostname/ip in the subnet until it finds one that matches the correct key file?
I am using a windows laptop (also connected via vpn) with cygwin to ssh to a Ubuntu 12.04 machine. I am not sure why I get a different hostname when I connect to the vpn, but it's a corporate network, so they get to do whatever they want.
2I'm not sure I understand, is this a virtual machine or a physical one? Why will the hostname change? OK for the IP, but the hostname? In any case, is running a script on the remote machine that queries its hostname and posts it somewhere an option? – terdon – 2013-06-04T18:03:13.597
You can do a broadcast ping (
ping -b
in Linux, not sure in Windows), and identify your machine via its MAC adress by displaying the ARP table (arp
in Linux,arp -a
in Windows). – mpy – 2013-06-04T18:07:25.113@mpy he'll still need to be connected to the remote machine for that right? – terdon – 2013-06-04T18:08:15.793
@terdon: I thought the broadcast would be enough to populate the arp table. A quick test was successful to identify some machines, but not for all... don't see a pattern, there is a explanation for sure, but I'm no network expert. – mpy – 2013-06-04T18:19:09.613
1@mpy he is connected via a VPN. If the VPN is routed, and not bridged, then a broadcast ping won't be possible. Broadcasts don't cross routers typically. Also, Linux hosts are often configured to not respond to broadcast pings. – Zoredache – 2013-06-04T18:22:06.313
I tried "arp -a" and unfortunately it looks like all machines that are connected over the vpn show the same mac address. – user229010 – 2013-06-04T18:57:36.133