Local servers / Routing

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
Radson90
New user
New user
Posts: 5
Joined: 2023-09-07 13:29

Local servers / Routing

Post by Radson90 » 2023-09-07 14:07

Hello,

Im running a local server which connect 3 hosts. I've set ip adresses for them from : 192.168.0.1 - 192.168.0.3 [LAN - workgroup + switch]
I've create a domain example.com - added 3 mail adresses , set basic configuration for clients and everything works great. I can send e-mails between this three hosts.

What I need right now is a possiblity to connect with another computer (in the same local network ) but I need to run another server on it and use another domain/subdomain for example uk.exapmle.com (it will work as a gate/hub)

I've try to generate routes but Im not able to reach example.com - domain adresses from uk.example.com e-mail adresses.

Any idea how should I configure a server and routes ?

User avatar
johang
Senior user
Senior user
Posts: 1054
Joined: 2008-09-01 09:20

Re: Local servers / Routing

Post by johang » 2023-09-07 15:31

Radson90 wrote:
2023-09-07 14:07
I've try to generate routes but Im not able to reach example.com - domain adresses from uk.example.com e-mail adresses.
on first server put something in like this :
anotherserverUK.png
anotherserverUK.png (46.83 KiB) Viewed 722 times
and

on second server put something in like this
anotherserver.png
anotherserver.png (52.45 KiB) Viewed 722 times

and in text i would desribe it as..
on first server create a route which points uk.example.com to the IP of second server
on second server create a route which points example.com to the IP of first server

Then you check in you SMTP logs in both servers to see what might be wrong after your test
lets cheat darwin out of his legacy, find a cure for cancer...

User avatar
SorenR
Senior user
Senior user
Posts: 6125
Joined: 2006-08-21 15:38
Location: Denmark

Re: Local servers / Routing

Post by SorenR » 2023-09-07 18:28

@johang Spot on!

I can send emails from my "production server" to my "backupMX server" to my "development server" and back simply by setting up Route information...

I even have a rule on my production server enabling me to send out via my "BackupMX server" if my primary ISP is down (yes I have two Internet connections - fiber and 4G). I have made a logical split in my physical LAN by having two DNS servers and two "Default Gateways" in the DHCP server.
Why ?
Well, I am lazy and have not had the time (energy) to read the manual for my "TL-R600VPN SafeStream Gigabit Multi-WAN VPN Router" on how to configure a multi-WAN setup.

Please note the use of "local email address" or "remote email address" corresponds to how you define your IP Ranges!
SørenR.

To understand recursion, you must first understand recursion.

Radson90
New user
New user
Posts: 5
Joined: 2023-09-07 13:29

Re: Local servers / Routing

Post by Radson90 » 2023-09-25 11:42

Sorry about late reply,

Routing doesn't work...

So If I understand It well, I need DNS server running to be able to input a mx record for sepcific domain ?

I want to stay local so I don't be using any external DNS providers.

LOGS :

"DEBUG" 1840 "2023-09-25 09:09:58.941" "Applying rules"
"DEBUG" 1840 "2023-09-25 09:09:58.941" "Performing local delivery"
"DEBUG" 1840 "2023-09-25 09:09:58.941" "Local delivery completed"
"TCPIP" 1840 "2023-09-25 09:09:58.941" "DNS MX lookup: example.com"
"DEBUG" 3228 "2023-09-25 09:09:58.941" "Adding task DeliveryTask to work queue SMTP delivery queue"
"TCPIP" 1840 "2023-09-25 09:09:58.941" "DNS - Query failure. Treating as temporary failure. Query: example.com, Type: 15, DnsQuery return value: 1460."
"DEBUG" 1840 "2023-09-25 09:09:58.941" "Failed to resolve email servers (MX lookup). Domain name: examle.com"

User avatar
SorenR
Senior user
Senior user
Posts: 6125
Joined: 2006-08-21 15:38
Location: Denmark

Re: Local servers / Routing

Post by SorenR » 2023-09-25 14:06

Radson90 wrote:
2023-09-25 11:42
Sorry about late reply,

Routing doesn't work...

So If I understand It well, I need DNS server running to be able to input a mx record for sepcific domain ?

I want to stay local so I don't be using any external DNS providers.

LOGS :

"DEBUG" 1840 "2023-09-25 09:09:58.941" "Applying rules"
"DEBUG" 1840 "2023-09-25 09:09:58.941" "Performing local delivery"
"DEBUG" 1840 "2023-09-25 09:09:58.941" "Local delivery completed"
"TCPIP" 1840 "2023-09-25 09:09:58.941" "DNS MX lookup: example.com"
"DEBUG" 3228 "2023-09-25 09:09:58.941" "Adding task DeliveryTask to work queue SMTP delivery queue"
"TCPIP" 1840 "2023-09-25 09:09:58.941" "DNS - Query failure. Treating as temporary failure. Query: example.com, Type: 15, DnsQuery return value: 1460."
"DEBUG" 1840 "2023-09-25 09:09:58.941" "Failed to resolve email servers (MX lookup). Domain name: examle.com"
Let's make a test...

NB! "acme.inc" is to be replaced with a domain/server of your choice!
NNB! I just tried on my server and, it works ;-) NO DNS, NO MX!

Assume you want to send email to "wile.e.coyote@acme.inc".

1: do a nslookup for "acme.inc"
2: Add "123.123.123.123 acme.inc" to your windows HOSTS file on your hMailServer server (locate here: C:\Windows\System32\drivers\etc)
3: Try send an email to "wile.e.coyote@acme.inc" and see if it works.
SørenR.

To understand recursion, you must first understand recursion.

Radson90
New user
New user
Posts: 5
Joined: 2023-09-07 13:29

Re: Local servers / Routing

Post by Radson90 » 2023-09-25 19:53

I think I don't understand what Is the purpose of this test.
When I change host file and do nslookup for example.com nothing change at all it still didn't see this domain (?).
I've added 123.123.123.123 example.com to host file. Try to send e-mail to another host from this domain and I was able to reach them.

So If Im running one server on 192.168.0.2 - domain : example.com
And second server on 192.168.0.3 - domain : uk.example.com

I need to change a host file on both computers to be able to reach each other domain ?

EDIT:

I should change a host file like this :
Domain [example.com] - host file : uk.example.com 192.168.0.3
Domain [uk.example.com] - host file : example.com 192.168.0.2 ?

User avatar
johang
Senior user
Senior user
Posts: 1054
Joined: 2008-09-01 09:20

Re: Local servers / Routing

Post by johang » 2023-09-25 20:07

Radson90 wrote:
2023-09-25 19:53
So If Im running one server on 192.168.0.2 - domain : example.com
And second server on 192.168.0.3 - domain : uk.example.com

I need to change a host file on both computers to be able to reach each other domain ?

EDIT:

I should change a host file like this :
Domain [example.com] - host file : uk.example.com 192.168.0.3
Domain [uk.example.com] - host file : example.com 192.168.0.2 ?
If you put IP first and name after in the HOSTS file
-> 192.168.0.3 uk.example.com
yes that would work to fool your servers when name resolving for those domain names.. ( and then you do not need to use routes )


but you should not need to change the HOSTS file if you use routes.
lets cheat darwin out of his legacy, find a cure for cancer...

User avatar
johang
Senior user
Senior user
Posts: 1054
Joined: 2008-09-01 09:20

Re: Local servers / Routing

Post by johang » 2023-09-25 20:56

Radson90 wrote:
2023-09-25 19:53
I've added 123.123.123.123 example.com to host file. Try to send e-mail to another host from this domain and I was able to reach them.
ehh ahh so.. a ROUTE in hmailserver preceds local name resolving from HOSTS file ( and HOSTS file preceds DNS resolving )
there is no meaning in trying to both setup ROUTEs and changing HOSTS file at the same time.. stick to 1 way to accomplish your need.

from your text.. my guess is that ROUTE works on that server for example.com ... because there is no emailserver rsponding on 123.123.123.123 so your server does not check the HOSTS file.. (just note there being a difference in naming a file host or hosts )
lets cheat darwin out of his legacy, find a cure for cancer...

Radson90
New user
New user
Posts: 5
Joined: 2023-09-07 13:29

Re: Local servers / Routing

Post by Radson90 » 2023-09-26 08:52

Strange things happend.

I was trying today to change the hosts file. I've set mapping to point ip adresses to a server from other domain.

And It doesn't work. Untill... I've made a hotspot on my example.com domain computer.

EBUG" 2384 "2023-09-26 08:37:48.591" "Creating session 78"
"TCPIP" 2384 "2023-09-26 08:37:48.591" "TCP - 127.0.0.1 connected to 127.0.0.1:110."
"DEBUG" 2384 "2023-09-26 08:37:48.591" "TCP connection started for session 77"
"POP3D" 2384 77 "2023-09-26 08:37:48.591" "127.0.0.1" "SENT: +OK POP3"
"POP3D" 2368 77 "2023-09-26 08:37:48.601" "127.0.0.1" "RECEIVED: CAPA"
"POP3D" 2368 77 "2023-09-26 08:37:48.601" "127.0.0.1" "SENT: +OK CAPA list follows[nl]USER[nl]UIDL[nl]TOP[nl]."
"POP3D" 2376 77 "2023-09-26 08:37:48.611" "127.0.0.1" "RECEIVED: USER 1@example.com"
"POP3D" 2376 77 "2023-09-26 08:37:48.611" "127.0.0.1" "SENT: +OK Send your password"
"POP3D" 2368 77 "2023-09-26 08:37:48.621" "127.0.0.1" "RECEIVED: PASS ***"
"POP3D" 2368 77 "2023-09-26 08:37:48.631" "127.0.0.1" "SENT: +OK Mailbox locked and ready"
"POP3D" 2392 77 "2023-09-26 08:37:48.631" "127.0.0.1" "RECEIVED: STAT"
"POP3D" 2392 77 "2023-09-26 08:37:48.631" "127.0.0.1" "SENT: +OK 3 1669"
"POP3D" 2368 77 "2023-09-26 08:37:48.641" "127.0.0.1" "RECEIVED: LIST"
"POP3D" 2368 77 "2023-09-26 08:37:48.641" "127.0.0.1" "SENT: +OK 3 messages (1669 octets)"
"POP3D" 2368 77 "2023-09-26 08:37:48.641" "127.0.0.1" "SENT: 1 482[nl]2 482[nl]3 705[nl]."
"POP3D" 2376 77 "2023-09-26 08:37:48.651" "127.0.0.1" "RECEIVED: UIDL"
"POP3D" 2376 77 "2023-09-26 08:37:48.651" "127.0.0.1" "SENT: +OK 3 messages (1669 octets)[nl]1 1[nl]2 2[nl]3 3[nl]."
"POP3D" 2376 77 "2023-09-26 08:37:48.661" "127.0.0.1" "RECEIVED: QUIT"
"POP3D" 2376 77 "2023-09-26 08:37:48.661" "127.0.0.1" "SENT: +OK POP3 server saying goodbye..."
"DEBUG" 2384 "2023-09-26 08:37:48.661" "Ending session 77"
"SMTPD" 2368 64 "2023-09-26 08:38:06.172" "127.0.0.1" "RECEIVED: MAIL FROM:<1@example.com> SIZE=357"
"SMTPD" 2368 64 "2023-09-26 08:38:06.182" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 2384 64 "2023-09-26 08:38:06.212" "127.0.0.1" "RECEIVED: RCPT TO:<test@uk.example.com>"
"SMTPD" 2384 64 "2023-09-26 08:38:06.222" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 2376 64 "2023-09-26 08:38:06.372" "127.0.0.1" "RECEIVED: DATA"
"SMTPD" 2376 64 "2023-09-26 08:38:06.372" "127.0.0.1" "SENT: 354 OK, send."
"DEBUG" 2384 "2023-09-26 08:38:06.502" "Adding task AsynchronousTask to work queue Asynchronous task queue"
"DEBUG" 2144 "2023-09-26 08:38:06.502" "Executing task AsynchronousTask in work queue Asynchronous task queue"
"DEBUG" 2144 "2023-09-26 08:38:06.502" "Saving message: {F9842ECB-E906-4985-BB77-B5D86B56FFE4}.eml"
"DEBUG" 2144 "2023-09-26 08:38:06.522" "Requesting SMTPDeliveryManager to start message delivery"
"SMTPD" 2144 64 "2023-09-26 08:38:06.532" "127.0.0.1" "SENT: 250 Queued (0.125 seconds)"
"DEBUG" 2200 "2023-09-26 08:38:06.542" "Adding task DeliveryTask to work queue SMTP delivery queue"
"DEBUG" 2248 "2023-09-26 08:38:06.562" "Executing task DeliveryTask in work queue SMTP delivery queue"
"DEBUG" 2248 "2023-09-26 08:38:06.572" "Delivering message..."
"APPLICATION" 2248 "2023-09-26 08:38:06.573" "SMTPDeliverer - Message 81: Delivering message from 1@example.com to test@uk.example.com. File: C:\Program Files\hMailServer\Data\{F9842ECB-E906-4985-BB77-B5D86B56FFE4}.eml"
"DEBUG" 2248 "2023-09-26 08:38:06.573" "Applying rules"
"DEBUG" 2248 "2023-09-26 08:38:06.574" "Performing local delivery"
"DEBUG" 2248 "2023-09-26 08:38:06.574" "Local delivery completed"
"TCPIP" 2248 "2023-09-26 08:38:06.575" "DNS MX lookup: uk.example.com"
"TCPIP" 2248 "2023-09-26 08:38:06.576" "DNS - Query failure. Treating as temporary failure. Query: uk.example.com, Type: 15, DnsQuery return value: 1460."
"DEBUG" 2248 "2023-09-26 08:38:06.576" "Failed to resolve email servers (MX lookup). Domain name: uk.example.com."
"APPLICATION" 2248 "2023-09-26 08:38:06.577" "SMTPDeliverer - Message 81: No mail servers could be found for the address test@uk.example.com."
"DEBUG" 2248 "2023-09-26 08:38:06.577" "Summarizing delivery result"
"DEBUG" 2248 "2023-09-26 08:38:06.577" "Summarized delivery results"
"DEBUG" 2248 "2023-09-26 08:38:06.578" "SD::RescheduleDelivery_"
"DEBUG" 2248 "2023-09-26 08:38:06.578" "Retrieving retry options."
"DEBUG" 2248 "2023-09-26 08:38:06.579" "Starting rescheduling."


After making a hotspot :

EBUG" 2384 "2023-09-26 08:41:08.833" "TCP connection started for session 79"
"SMTPC" 2384 79 "2023-09-26 08:41:08.833" "192.168.0.3" "RECEIVED: 220 localhost ESMTP"
"SMTPC" 2384 79 "2023-09-26 08:41:08.833" "192.168.0.3" "SENT: HELO localhost"
"SMTPC" 2368 79 "2023-09-26 08:41:08.843" "192.168.0.3" "RECEIVED: 250 Hello."
"SMTPC" 2368 79 "2023-09-26 08:41:08.843" "192.168.0.3" "SENT: MAIL FROM:<1@example.com>"
"SMTPC" 2376 79 "2023-09-26 08:41:08.853" "192.168.0.3" "RECEIVED: 250 OK"
"SMTPC" 2376 79 "2023-09-26 08:41:08.853" "192.168.0.3" "SENT: RCPT TO:<test@uk.example.com>"
"SMTPC" 2392 79 "2023-09-26 08:41:08.853" "192.168.0.3" "RECEIVED: 250 OK"
"SMTPC" 2392 79 "2023-09-26 08:41:08.853" "192.168.0.3" "SENT: DATA"
"SMTPC" 2392 79 "2023-09-26 08:41:08.863" "192.168.0.3" "RECEIVED: 354 OK, send."
"SMTPC" 2392 79 "2023-09-26 08:41:08.863" "192.168.0.3" "SENT: [nl]."
"SMTPC" 2392 79 "2023-09-26 08:41:09.063" "192.168.0.3" "RECEIVED: 250 Queued (0.203 seconds)"
"SMTPC" 2392 79 "2023-09-26 08:41:09.073" "192.168.0.3" "SENT: QUIT"
"SMTPC" 2376 79 "2023-09-26 08:41:09.073" "192.168.0.3" "RECEIVED: 221 goodbye"
"DEBUG" 2376 "2023-09-26 08:41:09.073" "Ending session 79"
"DEBUG" 2248 "2023-09-26 08:41:09.073" "External delivery process completed"
"DEBUG" 2248 "2023-09-26 08:41:09.073" "Summarizing delivery result"
"DEBUG" 2248 "2023-09-26 08:41:09.073" "AWStats::LogDeliverySuccess"
"DEBUG" 2248 "2023-09-26 08:41:09.083" "Summarized delivery results"
"DEBUG" 2248 "2023-09-26 08:41:09.083" "Deleting message"
"DEBUG" 2248 "2023-09-26 08:41:09.083" "Deleting message file."
"APPLICATION" 2248 "2023-09-26 08:41:09.083" "SMTPDeliverer - Message 81: Message delivery thread completed."

But It's only works when Im sending from example.com to uk.example.com and only when I have internet connection.
Sending from uk.example.com to example.com dosen't work.

Radson90
New user
New user
Posts: 5
Joined: 2023-09-07 13:29

Re: Local servers / Routing

Post by Radson90 » 2023-09-26 13:40

I've found a solution.

I've cleared a host file to it's default settings.

And set a routes for domains as it was mantionded before by @Johang.

The problem was in IP Ranges - I have to turn off the SMTP authentication. And now everything works perfect.

Anyway how can I provide authentication between two servers ?

Thanks for help !

User avatar
johang
Senior user
Senior user
Posts: 1054
Joined: 2008-09-01 09:20

Re: Local servers / Routing

Post by johang » 2023-09-26 17:39

Radson90 wrote:
2023-09-26 13:40
I've found a solution.
good work!

The problem was in IP Ranges - I have to turn off the SMTP authentication. And now everything works perfect.
Anyway how can I provide authentication between two servers ?
what you could easily do is on each server create an IPrange with the IP of the other server and in that IPrange specify no smtp authenticatio required, remember to set the priority higher than the priority of the LAN range in you settings ( because i think you want to have the security require SMTP authentication for your normal clients )
lets cheat darwin out of his legacy, find a cure for cancer...

User avatar
mattg
Moderator
Moderator
Posts: 22390
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Local servers / Routing

Post by mattg » 2023-09-26 23:49

Radson90 wrote:
2023-09-26 13:40
The problem was in IP Ranges - I have to turn off the SMTP authentication. And now everything works perfect.
I trust that you haven't created an open relay.

Please run the diagnostics and post the result
viewtopic.php?f=20&t=30914
Radson90 wrote:
2023-09-26 08:52
And It doesn't work. Untill... I've made a hotspot on my example.com domain computer.
And that is about loopback, or hairpinning on your modem router

It also means that your server is accessible on the internet. You could be spewing SPAM. Please run the diagnostics
(and also just hit the default button on IP ranges page to secure your server)
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply