Setting up sendmail with dynamic dns

Posted on 2001-07-06
Medium Priority
Last Modified: 2010-03-18
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 dyndns.org and one of their little update clients to map the domain foobar.homeip.net (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 sendmail.cf 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?


Question by:harlow

Expert Comment

ID: 6261357
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".
LVL 51

Expert Comment

ID: 6261466
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.

Expert Comment

ID: 6263606

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,

LVL 40

Accepted Solution

jlevie earned 300 total points
ID: 6266335
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 my-sys.my-domain.tld". 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\tmy-sys.my-domain.tld 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.

Author Comment

ID: 6337186
Thanks.  I think I am convinced that this is too much trouble to waste my time on!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question