Learning Linux: telnet and SMTP
I have three questions about telnet and smtp.
First I check to see if smtp service is available on CentOS7: Code:
[student@localhost ~]$ systemctl status | grep -i smtp Services should show up on systemctl. No? But on netstat, it shows smtp is running: Code:
student@localhost ~]$ netstat -taupe | grep smtp Q2: So why is smtp not showing up on command output like so: Code:
systemctl status | grep -i smtp I should be able to telnet into localhost like so: Code:
[student@localhost ~]$ telnet localhost 25 (Shown on last line for user, student. ) Code:
[student@localhost ~]$ netstat -taupe | grep smtp What did I missed? Thanks. |
Telnet onto a different port will not provide "a telnet prompt". It performs a TCP test on the specific application running on that port
|
If you telnet to port 80 on a web server, you can issue a "get" command to confirm you receive a web page.
If you telnet to port 25 on a mail server, you can issue SMTP commands like "ehlo" to confirm the SMTP service is working Your output states you are using postfix so if you want to check the services it should be for postfix |
Quote:
What port should I telnet? |
SMTP i.e Simple Mail Transfer Protocol is not a service. It is how some mail clients/servers talk to each other. The service that is running is postfix which by default runs on port 25. Since SMTP is ASCII you can use telnet to communicate with the postfix server but it isn't like a regular terminal session.
You can find many websites that post how to test SMTP via telnet. http://www.cisco.com/c/en/us/support...te-esa-00.html https://technet.microsoft.com/en-us/...exchg.65).aspx |
It's not that you shouldn't telnet to port 25 to test smtp access, but it will not act like a normal telnet session
It will let you issue smtp related commands and even let you send an email |
Quote:
Code:
[student@localhost ~]$ telnet localhost 25 So it is working. But why does it not show up as output of command: systemctl status ? How do I enable a telnet prompt? |
Have you had a chance to read through the links provided by Michaelk?
From testing your service, what happens when you run: systemctl status | grep -i postfix |
Quote:
|
The telnet protocol works like a terminal program for human interaction to a remote computer but SMTP is not. Since it does not work the same there isn't a prompt.
|
One more problem.
The above OP was done using a virtual machine. And I telnet from within the VM to its own localhost. Its IP addresses are: Quote:
Pinging from my laptop works for both IPs: Quote:
Quote:
So I disabled the firewall: Quote:
Quote:
Thanks! |
virbr0 is acting as a NAT router and I would guess that the host services are not listening on the virtual interface. If you want to access the host services from the guest you might need to configure it as a bridge.
|
Your previous output from netstat shows smtp listening on localhost therefore it is only available from within the host
You will need to look at changing your postfix configuration to listen on the IP of the server |
1 Attachment(s)
Quote:
thus the VM's IP has changed. Here is the VM's network setup: Code:
[student@localhost ~]$ ip a And here is what I tried with no success, meaning virtual bridge's state is still DOWN: Code:
[student@localhost ~]$ sudo ip link set virbr0 up I look into nmtui, and I am not sure what to do next to enable virbr0. virbr0 is already in nmtui. There is no provision to turn it on in nmtui. Here is the screen shot from VMware's setup: (There is no add image icon button in menu area for me to insert image here! But I was able to attach it to this post.) Looks like the setup in VMware is correct, no? What to do? Thanks. |
As Disillusionist posted postfix by default only listens to localhost. Edit inet_interfaces in the file /etc/postfix/main.cf
# Listen to all interfaces rather than strict to localhost inet_interfaces = all Just curious as to what you are trying to accomplish. |
All times are GMT -5. The time now is 03:55 PM. |