Topic Configure local Mail Service
Configure mail services on the system Server0 and DESKTOP0 to meet the following requirements:
-These systems do not receive messages sent from outside
-Any messages sent locally on these systems will automatically be routed to classroom.example.com
-Messages sent from these systems are displayed from the example.com
-You can test your configuration by sending mail to the local user student.
The classroom.example.com has been configured well. Go to the following URL for this user's message
Http://classroom.example.com/cgi-bin/recevied_mail operation
Use the Postfix service to complete the above topics. This service is typically installed by default and is in the default boot up state. But the advice is to check it.
Server0 and DESKTOP0 are configured in the same configuration and are only demonstrated with SERVER0. Method 1 directly modifies the configuration file/etc/postfix/main.cf
Mainly modify a few places
inet_interfaces = loopback-only #监听本地回环接口
myorigin = example.com #设置来源域名
relayhost = [classroom.example.com] # Server in transit, with brackets over the MX record
mydestination = #不接受任何邮件
mynetworks = 127.0.0.0/8, [:: 1]/128 #本地网络
Local_ Transport = error:local Delivery disabled #其实是非必须的
# systemctl Restart postfix Restart Mail Service Method 2 use postconf Modify
This is a tool designed to view postfix configurations and modify postfix configurations. Individuals also recommend this practice.
[Root@server0 ~]# postconf-e ' inet_interfaces=loopback-only ' [Root@server0 ~]#] postconf-e ' myorigin=example.com '
[Root@server0 ~]# postconf-e ' relayhost=[classroom.example.com] '
[Root@server0 ~]# postconf-e ' mydestination= '
[Root@server0 ~]# postconf-e ' MYNETWORKS=127.0.0.0/8] [:: 1]/128 '
[Root@server0 ~]# postconf-e ' local_transport=error:local delivery disabled '
[Root@server0 ~]# systemctl restart Postfix
Test
[Root@server0 ~]# mail-s ' fuxk ' student@classroom.example.com erwerwr. EOT [Root@server0 ~]# Curl Http://classroom.example.com/cgi-bin/recevied_mail from root@example.com Tue 3 14:43:46 2017<br>return-path: <root@example.com><br>x-original-to:student@classroom.example.com<br >delivered-to:student@classroom.example.com<br>received:from server0.example.com (server0.example.com [ 172.25.0.11]) <br>  by classroom.example.com (Postfix) with ESMTP ID 1bb802acc19<br>  for <student@classroom.example.com>; Tue, 3 2017 14:43:46 +0800 (CST) <br>received:by server0.example.com (Postfix, from UserID 0) <br>&nbs P;  id D05feeaeea; Tue, 3 2017 14:43:44 +0800 (CST) <br>date:tue, 2017, 14:43:44 E.com<br>subject:fuxk<br>user-agent:heirloom MAILX 12.5 7/5/10<br>MIME-Version:1.0<br>Content-Type:text/plain; Charset=us-ascii<br>content-transfer-encoding:7bit<br>message-id: <20170103064344. D05feeaeea@server0.example.com><br>from:root@example.com (Root) <br><br>erwerwr<br>
<br>