I have a machine inside the university. The computers are connected to the internet, but have non-valid IPs (NAT).
When I am not at the university, I connect to the university's network via VPN, and then I can ssh to the machine using its LAN IP.
I have to remember the machine's IP before leaving the office, so that I can ssh to it. However, in case that the computer restarts due to a poweroff, the DHCP assigns a new IP to the machine, and I don't know the new IP.
How can I configure the linux (ubuntu) machine so that it sends me the IP?
Obviousely, no user has logged on when the machine restarts, so my question is in two parts:
- Where should I put the script so that it runs without login?
- What should the script do? I prefer that it sends me an email containing the new IP, but it does not work: When I try
ifconfig | mail -s "new IP" [email protected]
, I receive no email.