Setting up sendmail with dynamic dns

Posted on 2001-07-06
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 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?


Question by:harlow
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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 100 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". 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.

Author Comment

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

Featured Post

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
squid3 ntlm and itunes authentication 5 94
Cant reach dockers repository (pull command) 11 93
Iptables and mirroring ports 4 93
(Open)LDAP V2.44  search proxy to AD (W2012R2) 37 213
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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