LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2005, 01:38 AM   #1
mtford
LQ Newbie
 
Registered: Jan 2005
Distribution: Scientific Linux (based on RHEL)
Posts: 11

Rep: Reputation: 0
Sendmail running behind router, with dynamic ip


I've am trying to operate an outgoing mail server (sendmail) on my machine, which is attached to a cable modem via an ethernet router.

I have configured sendmail to use my ISP's SMTP server as a smart_host... however, the SMTP server is bouncing all my mail, because my machine claims to have the hostname "gluon.local", instead of the real dynamic address assigned by the ISP (<something>.rcn.com). Similarly, if I type "hostname --fqdn", I get "gluon.local". How can I get the machine to find out its real FQDN instead of the local one allocated by the router? I tried removing the router's IP address (192.168.0.1) from /etc/resolv.conf and adding my ISP's DNS instead, but then I get "unknown host" when I run "hostname --fqdn".

I also tried removing the router and connecting my machine directly to the modem, and then everything works fine.

It's easy enough to write a script to find out my real IP address, by SSHing to a remote machine and asking it where I'm connecting from, i.e.
ssh me@somewhere.else 'echo $SSH_CLIENT'
but this doesn't help with configuring sendmail, since it always uses "hostname --fqdn" to find out the system identity.

Any help appreciated.
Matthew.
 
Old 01-24-2005, 06:05 AM   #2
scowles
Member
 
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 31
Posting the actual error message would have helped localize the problem you describe. So based on my interpretation of your post, I can only think of two possible causes as to why your system is being rejected by your ISP's mail server.

1) The initial connect from your system. i.e. telnet mail.yourisp.com 25

2) During the HELO handshake between the systems.
telnet mail.yourisp.com 25
helo mail.myhostname.com

I would be surprised if you are being rejected at item number one since your ISP probably assigns the reverse lookup name of your firewal's public IP address. But number two can be addressed by following the instructions at:

http://www.infohiiway.com/sendmail/#five

Step one is critical. Just change the name to be your systems hostname (like myhostname.rcn.com) since you do not have a valid MX record. Basically, the confDOMAIN_NAME changes how sendmail announces itself to the outside world. Thus overriding the derived fqdn at startup.
 
Old 01-24-2005, 08:15 AM   #3
mtford
LQ Newbie
 
Registered: Jan 2005
Distribution: Scientific Linux (based on RHEL)
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by scowles
Posting the actual error message would have helped localize the problem you describe. So based on my interpretation of your post, I can only think of two possible causes as to why your system is being rejected by your ISP's mail server.
The error is:

... while talking to smtp.rcn.com:
>>> DATA
<<< 550 rejected: cannot route to sender <ford@gluon.local>
554 5.0.0 Service unavailable
 
Old 01-24-2005, 06:06 PM   #4
mtford
LQ Newbie
 
Registered: Jan 2005
Distribution: Scientific Linux (based on RHEL)
Posts: 11

Original Poster
Rep: Reputation: 0
OK, now I'm really confused! According to the sendmail documentation, at
http://www.sendmail.org/m4/tweaking_config.html , confDOMAIN_NAME is supposed to provide the fully-qualified domain name for my machine, e.g. $w.FOO.com , where $w is the short domain name. But this would mean changing sendmail.mc, remaking sendmail.cf and restarting sendmail every time my machine gets a new dynamic IP!

Anyway, assuming this is what you meant, I tried adding the line

define(`confDOMAIN_NAME',
`xxx-xxx-xxx-xxx.mart-bsr1.chi-mart.il.cable.rcn.com')dnl

with my current real IP in place of the x's, and

define(`SMART_HOST', `smtp.rcn.com')dnl
MASQUERADE_AS(`my_real_email_domain.com')dnl

to send all outgoing mail via the ISP's SMTP server with ford@my_real_email_domain.com instead of ford@gluon.local on the envelope.

I telnetted to localhost on port 25, and sendmail correctly claims to be xxx-xxx-xxx-xxx.mart-bsr1.chi-mart.il.cable.rcn.com. However, then I created a simple mail, containing the following:

---
From: ford@my_real_email_domain.com
To: me@another_real_email_address.com
Subject: Hello

Testing...
---

I sent the mail using "sendmail -v -t < message", and got the following output (with addresses substituted throughout, apart from gluon.local):

-----
me@another_real_email_address.com... Connecting to localhost.local. via relay...
220 xxx-xxx-xxx-xxx.mart-bsr1.chi-mart.il.cable.rcn.com ESMTP Sendmail 8.12.9/8.12.9; Mon, 24 Jan 2005 17:54:21 -0600
>>> EHLO gluon.local
xxx-xxx-xxx-xxx-xxx.mart-bsr1.chi-mart.il.cable.rcn.com Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<ford@gluon.local> SIZE=78
250 2.1.0 <ford@gluon.local>... Sender ok
>>> RCPT To:<me@another_real_email_address.com>
>>> DATA
553 5.1.8 <me@another_real_email_address.com>... Domain of sender address ford@gluon.local does not exist
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
/home/ford/dead.letter... Saved message in /home/ford/dead.letter
Closing connection to localhost.local.
>>> QUIT
221 2.0.0 xxx-xxx-xxx-xxx.mart-bsr1.chi-mart.il.cable.rcn.com closing connection
-----

The corresponding entries in /var/log/mail/info are:

-----
Jan 24 17:54:17 gluon sendmail[24242]: j0ONsGgd024242: from=ford, size=78, class=0, nrcpts=1, msgid=<200501242354.j0ONsGgd024242@gluon.local>, relay=ford@localhost
Jan 24 17:54:26 gluon sendmail[24246]: j0ONsLBo024246: ruleset=check_rcpt, arg1=<me@another_real_email_address.com>, relay=localhost [127.0.0.1], reject=553 5.1.8 <me@another_real_email_address.com>... Domain of sender address ford@gluon.local does not exist
Jan 24 17:54:26 gluon sendmail[24242]: j0ONsGgd024242: to=me@another_real_email_address.com, ctladdr=ford (501/501), delay=00:00:10, xdelay=00:00:09, mailer=relay, pri=30067, relay=localhost.local. [127.0.0.1], dsn=5.1.8, stat=User unknown
Jan 24 17:54:26 gluon sendmail[24246]: j0ONsLBo024246: from=<ford@gluon.local>, size=78, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
-----

So, two things appear to be wrong. Firstly, the mail is being sent from ford@gluon.local, instead of from ford@my_real_email_domain.com. Secondly, I have relay=localhost, instead of relay=smtp.rcn.com, which suggests that the mail is being transmitted directly from my machine to the destination, instead of via smtp.rcn.com. Why are the MASQUERADE_AS and SMART_HOST not having any effect?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Static Server / Dynamic IP Router? Sapient Linux - Networking 19 10-28-2005 01:33 AM
Sendmail and Dynamic IP -> blacklisted mercyop Linux - Software 9 08-27-2005 02:48 AM
How to Update dynamic DNS with DHCP router? longblock454 Linux - Networking 4 05-18-2004 06:21 AM
ADSL dynamic IP router elmagico81 Linux - Networking 0 10-28-2003 12:43 AM
sendmail on a dynamic ip barazor Linux - General 3 01-30-2002 07:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration