Setting up sendmail with dynamic dns

I have a system running RedHat 7.1, connected to the net over a Time-Warner cable modem.  I get my IP address from TW's dhcp server, and it sometimes changes when I have to reboot.  I am using and one of their little update clients to map the domain (not the actual domain) to whatever actual ip address I have at the moment, and this works quite well.  I can use ssh and sftp to get into my system remotely via this domain name.

I would like to be able to send mail to a personal account on this machine as well, but so far, I can't figure out how to set it up.  I presume that I need to store the domain name somewhere on the local machine (/etc/hosts? /etc/defaultdomain? /etc/HOSTNAME?)  I also need to set up so it knows who it is and where to put incoming mail.  All of the documentation I have seen so far assumes that you have a fixed ip address. Is there a step-by step guide somewhere to setting up this kind of a configuration, or can someone spell it out for me here?


Who is Participating?
I think this can be made to work provided that two conditions are met before sendmail is started. The first is that the output of "hostname" must be that of the FQDN for your domain (you do have a registered domain name, right?) as registered for your IP at dydns. The second is that that the host record in /etc/hosts must reflect the current IP.

The hostname condition can be fixed in /etc/sysconfig/netowrk, or if DHCP insists on setting it each time you can easily override that with a "hostname". Fixing the hosts file record could be done with a shell or perl script. The following commands will build a valid hosts file:

# IP=`/sbin/ifconfig eth0|sed -ne 's/.*inet addr:\([0-9\.]*\) .*/\1/p'`
# echo -e "\tlocalhost.localdomain localhost" >/etc/hosts
# echo -e "$IP\ my-sys" >>/etc/hosts

The only problem that I see with doing this is how to handle a change in IP while the system is running. If that were to happen you'll need to kill sendmail, execute the above, and restart sendmail.
If you use this machine solely as a server, then I suggest yanking RH 7.1 and installing e-smith Linux. Has all you need by default, works well with dynamic DNS and ridiculously easy to configure via web, telnet or console. It uses qmail, not sendmail, by default, which more secure and easier to configure.

On the other hand, if this is a workstation... Sorry. Otta be a way... Search google for "dynamic dns sendmail configuration".
if you're new to sendmail it's best you get the O'Relly's Sendmail book (that with the bat on it). sendmail, even if you have read the book twice, is hard stuff. For newbies, especially on Linux, I recommend using postfix (probably qmail), 'cause it is much simpler to setup.

I think what you are trying to do is not simple because to send mail to your computer (by name), you must have a name, somebody must resolve this name to IP address and also assign a mail server for that name.

Now you need to resolve the following

1) What is the name of your domain/Machine?
2) Who is supposed to resolve your name to ip addresses?
3) Are they willing to dynamically assign and change mail servers for you and deliver it to you?
4) DNS changes if involved will always take several hours to be propagated accross the net.

Good Luck,

harlowAuthor Commented:
Thanks.  I think I am convinced that this is too much trouble to waste my time on!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.