0
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" myEmail@gmail.com
, I receive no email.
Thanks. Are there any relays that I can use without providing my real email credentials? e.g. sending the email from
localuser@localdomain
tomyEmail@gmail.com
using the mail command. I triedsmtp.gmail.com
and it does not work. I don't know so much about relays though :( – Ali – 2017-07-12T14:12:42.660@Ali, that's all out of my wheel house too. I would guess outgoing SMTP might be blocked (on port 25 at least). Try a different port. Gmail also allows incoming SMTP on port 465. – Darren – 2017-07-12T14:14:16.793
1You can probably directly deliver mail to your university's mail server without credentials. Generally, open relays are discouraged because they are useful to spammers for hiding the originating source of the message. However, you can usually connect directly to the target mail server and deliver your message. You could set your message sender to something like root@currentip to try to avoid message filters. – lungj – 2017-07-12T15:05:01.950