I have my laptop sitting at my desk at home. I need a file, so I launch SSH, only to find out that I can’t connect. Then I remember that the last time I booted, I received a DHCP address from my router. I have no idea what the address is that is assigned, and as such, can’t access the OpenSSH server on my laptop to get what I need. So, thanks to the help of a friend, I use nmap to do a ping sweep in my LAN, to find out what IP was assigned:
aaron@achilles:~$ nmap -sP 192.168.1.0/24 Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-03 11:04 MDT Host achilles (192.168.1.3) appears to be up. Host hercules (192.168.1.114) appears to be up. Host 192.168.1.111 appears to be up. Nmap finished: 256 IP addresses (3 hosts up) scanned in 2.288 seconds
There it is. 192.168.1.114. That would’ve taken a while to find by hand. Next thing to do, is SSH into hercules, and change the IP to it’s normal static IP that it should be. This is easy, by just opening /etc/network/interfaces and adding and saving the following:
iface eth0 inet static address 192.168.1.4 netmask 255.255.255.0 gateway 192.168.1.111
Last thing that needs to be done? Restart networking:
root@hercules:~$ ifdown eth0;ifup eth0
Now I can SSH and SCP the file I need, going about my way. Beautiful.