I don't want to specify an IP address, since it can change in a DHCP LAN. I tried to connect to the linux server's name, but neither Putty nor Windows' ping.exe could resolve it.
feedback
|
|
I can see solutions in a couple of categories:
| |||
|
feedback
|
|
You can configure dhcp to send a hostname with the dhcp request. Obviously you would need your dhcpd and nameserver to support this, but lots of routers support this feature so its worth checking if yours does. | |||||
feedback
|
|
Unfortunately, you're rather out of luck. In order to do this you need to use something like mDNS. It is implemented out of the box in OSX, called Bonjour, but hasn't reached critical mass outside of Apple yet. If you control the DHCP server you could set up DHCP Reservations for specific systems. In this scenario a nic with a specific MAC address will always get the same, statically defined, address from the DHCP server. | |||||
feedback
|
|
You won't be albo to resolve the address unless it's in some DNS server. You need to know the IP address or you can use some services like No-IP to update a FQDN to the servers current IP address. Of course this will only work for a server that has a public IP address. For internal addresses you might want to write a script on the server that will send you the IP that is has at some point in time. | |||
|
feedback
|
|
Some things in your question are still unclear, but i'll try to give a broad answer. In order to connect to the machine via it's hostname, you need a name-resolution service active on the network - that is, a DNS or WINS server. Seeing that you say your machines cannot ping each other by name, it appears that you have no DNS server in the network (or that neither machine is set up with a primary DNS server). Which begs the question - what network enviroment would have DHCP but no DNS? If there IS a DNS server on the network, then you just have to set both machines up to contact it (network connection properties in windows, god-knows-where.conf in linux) and you're all done. Let's assume no DNS server then. Assuming you have control over the DHCP server in your network, the easiest solution would be to set up a static ip mapping in the DHCP server. Make it give the linux server the same ip each time (bind a specific ip to the server's nic's MAC address). Then you can edit the hosts file on the windows workstation (found in %systemroot%\system32\drivers\etc) and map a specific name to the address, and enjoy yourself. If you don't have control over the DHCP... Well, personally, i would just go bug the people who do (and tell them to get a DNS server in there for god sakes!) I can think of other wild stuff that could circumvent all around this issue (write a script that pings the whole subnet, runs arp -a into a file, and then scans it to find the MAC address of the server, thereby resolving it's IP.. sheesh, this is sick). Seriously though, I would try to get a decent name resolution service up and running. | |||
|
feedback
|
|
I also have Linux server on a DHCP network. The easiest way I've found to use DHCP and still be able to easily connect to the server is to give it a static ip. You can still use DHCP for other clients, but have a static ip for your server. You don't say what Linux distro you use, but here's the relevant part of my rc.conf from Arch Linux.
| |||
|
feedback
|
|
As others have pointed out, the problem is with name resolution, not SSH. But the best solution is to configure the DNS, DHCP Server and DHCP Client so that a DNS entry is created automtaically for all the DHCP clients. This is easily done with Microsoft's DHCP server (I should be able to provide instructions if that's helpful) but should also be possible with other servers. Basically you need:
| |||
|
feedback
|