Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]unable to connect to a local mail server on a VM
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Sun Jun 26, 2022 7:12 am    Post subject: [SOLVED]unable to connect to a local mail server on a VM Reply with quote

Hi everyone, how is it going. i have a small issue and i need some help.
i am making a local email server and i am supposed to connect to it through thunderbird. (to be honest this an assignment for my class at the university)
the mail server is on a virtual machine running centos7, the used software are postfix, dovecot, telnet and thunderbird (installed on centos)
the mail client is installed on the host which my computer running gentoo.
after making sure as much as possible the mail server is installed and setup correctly, opening port 80 on the mail server and disabling selinux,
i tried to connect the mail client on the host system to the server. (i changed the settings of the host name and domain on /etc/hosts and the main config file of postfix of course)
i failed all the time, i made sure there is connection between the server and the client using netcat and ssh and they both worked.
i thought that i need to open ports on the server so i looked for the ports to open, i found they are 25 for smtp.after this step i didn't succeed in the connexion though.
i thought of opening ports on my host gentoo system, it uses ip tables by default so i looked here and there and found many articles and threads on forums including this one https://forums.gentoo.org/viewtopic-p-3513726.html
which sounds like it is kinda complicated and not solved either ip thus i thought of installing firewalld on my host gentoo system and do the process through it, meanwhile i had a desire to implement nf-tables so i did it.
i opened the ports on my host system using firewalld which are 143 for imap and 110 for pop3 but still cannot connect to the mail server. i opened the same ports on the mail server but got the same results.
i don't know what to do to solve this problem it is not that serious though, if any of you would help please don't hesitate, i will appreciate it.
thank you
_________________
i would like to thank everyone that contributed to the gentoo project in any means


Last edited by abdus on Wed Jun 29, 2022 5:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Sun Jun 26, 2022 10:56 am    Post subject: Reply with quote

Go to your client and try to connect to the email-server with telnet:
Code:
telnet <IP address of your server> 25

You should see something like
Code:
# telnet 10.0.0.2 25
Trying 10.0.0.2...
Connected to 10.0.0.2.
Escape character is '^]'.
220 <server name> ESMTP Postfix

If that doesn't work, check
  1. the routing on your client and on your server
  2. firewalls
  3. make sure that postfix is running and that postfix is listening on <IP address of your server>:25.
Don't do anything else before that works.

If it works, try
Code:
telnet <name of your server> 25

If it doesn't work: check your name service

If it works: try to send an email using Thunderbird.

Good luck!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54243
Location: 56N 3W

PostPosted: Sun Jun 26, 2022 11:11 am    Post subject: Reply with quote

abdus,

Port 25 and 110 are for insecure mail.
25 is incoming, 110 is to pick up your mail using POP3

There are other ports for secure mail services but don't worry about that until it works.
You can send (to port 25) with telnet.
You only need type all the commands by hand.
As this is a uni assignment, I'll leave you to discover how.

Thunderbird works for POP3 and POP3S, I use it for both.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Sun Jun 26, 2022 12:40 pm    Post subject: Reply with quote

thank you for your answers i will apply them soon and tell you,however i wanted to inform you that i do not necessarily need to make a secure local mail server with its client i need it to be insecure and plain just like the task says. i forgot there are types of mail servers secure or encrypted and insecure and without encryption
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Sun Jun 26, 2022 3:17 pm    Post subject: Reply with quote

i tried the command telnet 172.16.116.145 25 which is the ip address of the vm containing the mail server, it worked and showed similar output
i tried to change the domain name of the email address and the hostname to that ip address when setting up thunderbird, thunderbird detected the server but i still cannot connect and the error is "unable to log in at server. probably wrong configuration username or password. at the beginning it cannot detect the server
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54243
Location: 56N 3W

PostPosted: Sun Jun 26, 2022 3:45 pm    Post subject: Reply with quote

abdus,

Using telnet, send an email.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Sun Jun 26, 2022 5:54 pm    Post subject: Reply with quote

i sent an email using telnet as you wanted sir, i don't know if it is sent successfully since i tried to check the user inbox through telnet itself but i get authentication failed even if i put correct username and password correctly.
when sending the mail i got this message:
250 2.0.0 Ok: queued as EE06B212B555
i hope it means it is sent successfully
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54243
Location: 56N 3W

PostPosted: Sun Jun 26, 2022 7:18 pm    Post subject: Reply with quote

abdus,

Good, it appears that everything works.
If you sent the mail to yourself, it will be in your inbox on the mailserver.
Do you have ssh access, so you can log in and check?

Regardless, it looks like Thuderbirds smtp (sending) needs be be configured.
Under Account Settings, at the bottom is Outgoing Server (SMPT)

Click Edit SMTP server ...
The Description is not important.
The Server Name must resolve to the mailserver. Make a note of it, if you need to. We will check later.

Connection security should be none.
Authentication method is Normal password.
Your user name is whatever you set up or was assigned to you.
The Port should be 25

You have verified the username and password in your telnet session.
Code:
ping <Server Name>
should return the IP address of your server.
It need not but not responding to ping is considered bad netequette.

172.16.116.145 is in a private IPv4 address range, so its up to you or your Uni to make the name resolve.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Mon Jun 27, 2022 6:05 pm    Post subject: Reply with quote

Mr Neddy, in the task i am supposed to connect to a local name which is assigned to the VM private ip address
however when doing so, what happen is that all the local domain names i choose for the VM are not assigned to it,
when looking for it using nslookup or when pinging
they take me to a public ip address which is 36.86.63.182
by the way the first VM with the mail server was broken,
i took a friend's VM which he said it is working and i am testing on it.
probably it worked for him because he is using windows
his domain name is mail.adit.sisjarlab.io
the output of nslookup mail.adit.sisjarlab.io and my other VM with any domain name (i changed it to avoid the potential confusion with that public ip address that is mentioned above)
is as follows:
Server: 192.168.1.1
Address: 192.168.1.1#53

Non-authoritative answer:
Name: mail.adit.sisjarlab.io
Address: 36.86.63.182
Name: mail.adit.sisjarlab.io
Address: 36.86.63.182
when pinging to that name i got this:
PING mail.adit.sisjarlab.io (36.86.63.182) 56(84) bytes of data.
64 bytes from 36.86.63.182: icmp_seq=1 ttl=248 time=4.25 ms
64 bytes from 36.86.63.182: icmp_seq=2 ttl=248 time=3.50 ms
64 bytes from 36.86.63.182: icmp_seq=3 ttl=248 time=3.87 ms
^C64 bytes from 36.86.63.182: icmp_seq=4 ttl=248 time=7.07 ms
when i try to login to any email using thunderbird the server is not found by thunderbird but when using the private ip address of the VM
it is found with the error
unable to login at server probably wrong configuration username or password
when i try to use my friend's account on the VM itself that he logged in with thunderbird before, it says
unable to connect to the server connection refused
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Mon Jun 27, 2022 6:15 pm    Post subject: Reply with quote

i can connect to the VM using ssh as well as pinging to its private ip address
no problem with it
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54243
Location: 56N 3W

PostPosted: Mon Jun 27, 2022 7:00 pm    Post subject: Reply with quote

abdus,

Quote:
in the task i am supposed to connect to a local name which is assigned to the VM private ip address
however when doing so, what happen is that all the local domain names i choose for the VM are not assigned to it,


I don't understand. At least, there are a few things not clear.

Your telnet test showed that the VM mail server accepted a mail from you.
You set up the Thunderbird outgoing (SMTP) settings in exactly the same way.

Normally, the Uni would run its own DNS server and it would be set up with a Name to IP mapping
For DNS to work, you must use the name that the Uni assigned.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Tue Jun 28, 2022 6:35 am    Post subject: Reply with quote

for my case i assign the domain name myself in /etc/hosts of centos7 vm
i have to find it in the local network that is made by vmware
what you're saying is right but every student in our case is supposed to have his own local network with his own domain name
i'm sorry if did not clarify things enough
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54243
Location: 56N 3W

PostPosted: Tue Jun 28, 2022 11:50 am    Post subject: Reply with quote

abdus,

I understand better now.

You host the VM yourself. It doesn't matter if it's on the same system as you are sending email from or on another.
In the VM setting the hostname only changes the prompt you see at the VM console.
It does nothing for name resolution.

Try this test.
Code:
ping <IP-of-VM>
ping <hostname-of-VM>


I expect the first to work and the second to fail because there is no DNS entry anywhere for <hostname-of-VM>.
There are two fixes. The hard one. Run your own DNS server to assign names and IPs to your VMs. Don't do that.
The easy one. Make an entry in your Gentoo /etc/hosts that resolves <IP-of-VM> to <hostname-of-VM>
Like
Code:
192.168.10.3            ntpi            # Raspberry Pi GPS Clock


Now both ping tests should work.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Wed Jun 29, 2022 2:03 pm    Post subject: Reply with quote

you're right sir, pinging to the hostname of the VM didn't work till i put it in /etc/hosts file of my gentoo host system
thunderbird has become able to detect the domain name whenever it is input with email but i still cannot login, it says
unable to login at server . probably wrong configuration, username or password.
above that error message a green message of checking the password appears and it is ticked.
before this thunderbird finds the server only by using its ip address not by the hostname
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
abdus
Apprentice
Apprentice


Joined: 10 Feb 2021
Posts: 189
Location: bandung

PostPosted: Wed Jun 29, 2022 5:30 pm    Post subject: Reply with quote

i guess i can say that we have reached an end for this thread since it worked, the things that you helped me with, mr neddy and mr mike were very useful

your solutions helped me solve most of the problem
i remembered that i can change the network settings of the VM in vmware settings from NAT to bridge and that solved all the issue. i even found the email that i sent through telnet.
you helped me a lot guys thank you very much, you are really awesome.
_________________
i would like to thank everyone that contributed to the gentoo project in any means
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum