First, configure the mail domain name server
[Email protected] root]# vi/var/named/gr.org.db
$TTL 86400@ in SOA ns.gr.org. Root.gr.org. ( 20140308 ; serial 8H ; refresh 4M ; retry 1W ; expiry 1D ) ; minimum@ In NS ns.gr.org.ns in a 192.168.170.1host1 in a 192.168.170.1host2 in a 192.168.170.2host3 in a 192.168.170.3@ in MX ten mail.gr.org.mail in A 192.168.170.1
Restart Service
[email protected] root]# RNDC Reload
Test
[Email protected] root]# Nslookup-sil mail.gr.org
server:192.168.170.3
address:192.168.170.3#53
Name:mail.gr.org
address:192.168.170.1
Second, sendmail configuration
1. See if SendMail is installed.
[Email protected] root]# Cd/etc/mail
[Email protected] mail]# rpm-q sendmail
Sendmail-8.12.8-4
(SendMail Configuration Experiment key steps:
Modify SENDMAIL.MC, and then generate SENDMAIL.CF by M4
Modify Local-host-name to set up a domain for a received message
Access control generates ACCESS.DB through Makemap
Aliases set up mass through newaliases generation aliases.db
Service SendMail Restart (restart services)
)
2. Configure the core file:
[Email protected] mail]# VI/ETC/MAIL/SENDMAIL.MC
Change the place as below 3
1) Listening Network segment
Daemon_options (' port=smtp,addr=127.0.0.1, Name=mta ') dnl
Switch
Daemon_options (' port=smtp,addr=0.0.0.0, Name=mta ') dnl
2) Local domain name
Local_domain (' Localhost.localdomain ') dnl
Switch
Local_domain (' gr.org ') dnl
3) Turn on the authentication function:
Remove the DNL from the beginning of the following three lines:
DNL daemon_options (' Port=submission, Name=msa, M=ea ')
DNL Trust_auth_mech (' EXTERNAL digest-md5 cram-md5 LOGIN PLAIN ') dnl
DNL define (' confauth_mechanisms ', ' EXTERNAL GSSAPI digest-md5 cram-md5 LOGIN PLAIN ') dnl
3, establish/ETC/MAIL/SENDMAIL.CF
[Email protected] mail]# M4/ETC/MAIL/SENDMAIL.MC >/ETC/MAIL/SENDMAIL.CF
4. Set the domain of the pickup
[Email protected] mail]# vi/etc/mail/local-host-names
gr.org
mail.gr.org
5. Set up groups and users
[Email protected] mail]#Groupadd Stu
[Email protected] mail]#useradd huji-g stu-s/sbin/nologin
[Email protected] mail]#passwd Huji
Changing password for user Huji.
New Password:
Bad Password:it are based on a dictionary word
Retype new Password:
Passwd:all authentication tokens updated successfully.
[Email protected] mail]#useradd stu-g stu-s/sbin/nologin
[Email protected] mail]#passwd Stu
Changing password for user Stu.
New Password:
Bad Password:it are based on a dictionary word
Retype new Password:
Passwd:all authentication tokens updated successfully.
[Email protected] root]# useradd wuji-g stu-s/sbin/nologin
[Email protected] root]# passwd Wuji
Changing password for user Wuji.
New Password:
Retype new Password:
Passwd:all authentication tokens updated successfully.
6, set the mass alias:
[Email protected] mail]# vi/etc/aliases
Add two lines:
Root:root,yanji
Stu:yanji,wuji,huji
7. Generate ALIASES.DB Database:
[Email protected] mail]# newaliases/etc/aliases:64 aliases
/etc/aliases:65 aliases, longest bytes, 657 bytes Total
8. Set access control:
[Email protected] mail]# vi/etc/mail/access
192.168.170.0/24 RELAY
Gr.org RELAY
Mail.gr.org RELAY
9. Update Aliases.db Database
[Email protected] mail]# makemap-r hash/etc/mail/access.db </etc/mail/access
10. Restart Service
[Email protected] mail]#Service SendMail Restart
Close sendmail: [OK]
Close sm-client: [OK]
Start sendmail: [OK]
Start sm-client: [OK]
Now, test it.