第十一次笔记
来源:互联网 发布:盲打软件 编辑:程序博客网 时间:2024/06/05 06:41
dig -t mx 域名
邮件发送 smtp
邮件接收 dovecot服务提供协议
开启25端口
电子邮件发送
服务器使用SMTP协议将电子邮件提交至TCP端口25,或由本地客户端通过
/usr/bin/sendmail程序进行提交。如果该MTA是最终目标位置,邮件将传递至MDA。否
则,将使用MX记录在DNS中查找下一个MTA,并使用SMTP进行转发。
MDA:“邮件发送代理”。MDA将邮件发送至收件人的本地邮件存储位置(默认情
况下是/var/spool/mail/user)。Postfix提供自己的MDA,以发送至基于文件的本地默认
邮件存储位置/usr/libexec/postfix/local.
转发:电子邮件服务器(MTA)将提交的邮件转发至另一个服务器,以进行发送
排队:失败的发送或转发尝试排队等待,并由MTA定义重试。(默认情况下,Postfix
每小时执行此操作一次)
拒绝:在首次提交期间,电子邮件被电子邮件服务器拒绝
退回:远程服务器接受电子邮件以进行发送以后,又将该电子邮件退回给始发电子邮
件服务器和/或用户
电子邮件以进行发送以后,又将该电子邮件退回给始发电子邮件服务器和/或用户
myorigin
重写本地发布的电子邮件,使其显示为来自该域。这样有助于确保响应返回入站邮件服务器
默认:myorigin = $myhostname
inet_interfaces
控制Postfix侦听传入电子邮件的网络接口。如果设置为loopback-only,仅侦听127.0.0.1和::1,
如果设置为all,则侦听所有网络接口。还可以指定特定地址。
默认:inet_interfaces = localhost
mydestination
收到地址为这些域的电子邮件将传递至MDA,以进行本地发送。
默认:mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks
IP地址和网络的逗号分隔列表(采用CIDR表示法)。这些地址和网络可以通过此MTA转发至
任何位置,无需进一步身份验证。
默认:mynetworks = 127.0.0.0/8
############邮件的发送 ####################
##mailwestos##
vim /etc/postfix/main.cf
76 myhostname = mailwestos.westos.com
83 mydomain = westos.com
99 myorigin = $mydomain
113 inet_interfaces = all
114 #inet_interfaces = $myhostname
115 #inet_interfaces = $myhostname, localhost
116 #inet_interfaces = localhost
164 mydestination = $myhostname, $mydomain, localhost
systemctl restart postfix
##maillinux##
vim /etc/postfix/main.cf
76 myhostname = maillinux.linux.com
83 mydomain = linux.com
99 myorigin = $mydomain
113 inet_interfaces = all
114 #inet_interfaces = $myhostname
115 #inet_interfaces = $myhostname, localhost
116 #inet_interfaces = localhost
164 mydestination = $myhostname, $mydomain, localhost
systemctl restart postfix
##测试##
mailwestos
mail root@linux.com
如果发送成功。则mailq中显示mail queue is empty
如果未成功,则显示信息
注意:火墙未关闭时,显示
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
B6EA924664C 439 Fri Mar 10 21:30:44 root@westos.com
(connect to 172.25.254.228[172.25.254.228]:25: No route to host)
root@linux.com
-- 0 Kbytes in 1 Request.
清空邮件 > /var/spool/mail/root
处理邮件队列 postqueue -f
#####别名或者群发#######
vim /etc/aliases
96 #root: marc
97 admin: root
注意:
别名是指把发送者的用户改变,并不能从本机发送到其他主机,但是其他主机却可以用这个别名来发送到该本机。
##测试##
操作环境:mailwestos
mail admin@linux.com
##群发###
vim /etc/aliases
more: :include:/etc/postfix/users
postalias /etc/aliases ##加密
vim /etc/postfix/users ##建立群组,里面填用户
student
root
systemctl restart postfix
##测试##
从另一台主机向本机发送邮件,more@westos.com
mail -u student
##伪装用户名和域名##
vim /etc/postfix/virtual
295 hello@qq.com root@linux.com ##伪装linux.com为qq.com
296 @qq.com @linux.com
postmap /etc/postfix/virtual
postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"
systemctl restart postfix
##测试##
[root@maillinux ~]# mail student@qq.com
Subject: sd
xc
.
EOT
查看时:[root@maillinux ~]# mail -u student
对mailwestos进行设置,使其能够向maillinux中发送,mail root@qq.com
cp -p linux.com.zone qq.com.zone
$TTL 1D
@ IN SOA dns.qq.com. root.qq.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.qq.com.
dns A 172.25.254.147
qq.com.MX 1 172.25.254.247.
vim /etc/named.rfc1912.zones
zone "qq.com" IN {
type master;
file "qq.com.zone";
allow-update { none; };
};
systemctl restart named
######出栈伪装#####
vim /etc/postfix/generic
root@linux.comroot@qq.com
postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"
postmaps /etc/postfix/generic
systemctl restart postfix
1.远程检测端口
通过远程主机检测maillinux的25端口
[root@foundation47 ~]# telnet 172.25.254.247 25
Trying 172.25.254.247...
Connected to 172.25.254.247.
Escape character is '^]'.
220 maillinux.linux.com ESMTP Postfix
ehlo ss
250-maillinux.linux.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from :root@westos.com
501 5.5.4 Syntax: MAIL FROM:<address>
mail from:root@westos.com
250 2.1.0 Ok
rcpt to:root@westos.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
xxxxxx
.
250 2.0.0 Ok: queued as 80CAD17E86E
quit
221 2.0.0 Bye
Connection closed by foreign host.
结果:
[root@mailwestos named]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 root@westos.com Wed Mar 15 03:23 13/500
& 1
Message 1:
From root@westos.com Wed Mar 15 03:23:38 2017
Return-Path: <root@westos.com>
X-Original-To: root@westos.com
Delivered-To: root@westos.com
Status: R
xxxxxx
#########邮件接受服务,dovecot#############
1.
yum install dovecot -y
vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp
48 login_trusted_networks = 0.0.0.0/0##允许访问网络地址
49 disable_plaintext_auth =no##开启明文认证
vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mkdir /home/student/mail/.imap/
touch ./INBOX
systemctl restart dovecot
##测试###
[root@foundation47 ~]# mutt -f pop://student@172.25.254.247
q:Quit d:Del u:Undel s:Save m:Mail r:Reply g:Group ?:Help
---Mutt: pop://student@172.25.254.247/ [Msgs:0]---(date/date)-----------(all)---
There are no messages.
/etc/skel/mail/.imap/INBOX 这条命令就是让新建的用户能自动建立该文件夹和目录
2.利用mysql创建虚拟用户
yum install mariadb-server httpd php php-mysql -y
vim /etc/my.cnf
skip-networking=1
mysql_secure_installation
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
mv phpMyAdmin-3.4.0-all-languages/ mysqladmin
cp config.sample.inc.php config.inc.php
vim config.inc.php
$cfg['blowfish_secret'] = 'test';
mysql -uroot -p
create user postfix@localhost identified by 'postfix';##创建用户
grant insert,select on email.* to postfix@localhost;##授权
用用户进入图形界面创建数据库和表
[root@maillinux postfix]# groupadd -g 666 vmail
[root@maillinux postfix]# useradd -u 666 -g 666 vmail
[root@maillinux postfix]#vim mysql-user.cf
hosts = localhost
user = postfix
password = postfix
dbname = email
table = mailsql
select_field = username
where_field = username
[root@maillinux postfix]#vim mysql-domain.cf
hosts = localhost
user = postfix
password = postfix
dbname = email
table = mailsql
select_field = domain
where_field = domain
[root@maillinux postfix]#vim mysql-mailbox.cf
hosts = localhost
user = postfix
password = postfix
dbname = email
table = mailsql
select_field = maildir
where_field = username
使用postmap -q 使文件生效 -p 查看生效结果
postmap -q "admin@redhat.com" mysql:/etc/postfix/mysql-user.cf
admin@redhat.com
[root@maillinux postfix]# postmap -q "admin@redhat.com" mysql:/etc/postfix/mysql-mailbox.cf
/redhat.com/admin
[root@maillinux postfix]# postmap -q "redhat.com" mysql:/etc/postfix/mysql-domain.cf
redhat.com
[root@maillinux postfix]# vim /etc/postfix/main.cf
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
virtual_mailbox_base = /home/vmail
virtual_gid_maps = static:666
virtual_uid_maps = static:666
virtual_alias_maps = mysql:/etc/postfix/mysql-user.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-mailbox.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-domain.cf
问题:
(maildir delivery failed: create maildir file /home/vmail???##????????????//redhat.com/admin/tmp/1489571682.P11445.maillinux.linux.com: Permission denied)
admin@redhat.com
配置有问题。
###测试###
mail admin@redhat.com
然后在/home/vmail/下查看
#############接收邮件###############
yum install dovecot-mysql.x86_64 -y
1.配置dovecot服务
2.cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext
vim /etc/dovecot/dovecot-sql.conf.ext
32 driver = mysql
71 connect = host=localhost dbname=email user=postfix password=postfix
78 default_pass_scheme = plain
107 password_query = \
108 SELECT username, domain, password \ ##要与数据库中建立的名字一样
109 FROM mailuser WHERE username = '%u' AND domain = '%d'
125 user_query = SELECT maildir, 888 AS uid, 888 AS gid FROM mailuser WHERE username = '%u'
3.vim /etc/dovecot/conf.d/10-auth.conf
122 !include auth-system.conf.ext
123 !include auth-sql.conf.ext
4.vim /etc/dovecot/conf.d/10-mail.conf
30 mail_location = maildir:/home/vmail/%d/%n
在真机里面
[kiosk@foundation47 Desktop]$ telnet 172.25.254.247 110
Trying 172.25.254.247...
Connected to 172.25.254.247.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user admin@redhat.com
+OK
pass 123
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host.
然后启动雷鸟,进行邮件的发送。
#########ipv6#########
网络配置:
高级配置:
网络桥接用网络桥实现共享上网主机和客户机除了利用软件外,还可以用系统自带的网络桥建立连接用双网卡的机器做主机
vim vim ifcfg-ens0s25
DEVICE=enp1s25
ONBOOT=yes
BOOTPROTO=none
BRIDGE=br0
vim ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
TYPE=Bridge
IPADDR=172.25.254.28
PREFIX=24
#GATEWAY=172.25.254.250 ##当设置这个时,无线网络连接不了。
brctl
– show ### 显示
– addbr ### 添加网桥
– delbr ### 删除网桥
– addif ### 添加网桥连接
– delif ### 删除网桥连接
##brctl show##
bridge name(网桥名字) bridge id(网桥ID) STP enabled interfaces(连接设备)
###############bond 网络###############
• Red Hat Enterprise Linux 允许管理员使用
bonding 内核模块和称为通道绑定接口的
特殊网络接口将多个网络接口绑定到一个通
道。根据选择的绑定模式 , 通道绑定使两个
或更多个网络接口作为一个网络接口 , 从而
增加带宽和 / 提供冗余性
选择 Linux 以太网绑定模式
• 模式 0 ( 平衡轮循 ) - 轮循策略 , 所有接口都使用
采用轮循方式在所有 Slave 中传输封包 ; 任何
Slave 都可以接收
• 模式 1 ( 主动备份 ) - 容错。一次只能使用一个
Slave 接口 , 但是如果该接口出现故障 , 另一个
Slave 将 接替它
• 模式 3 ( 广播 ) - 容错。所有封包都通过所有
Slave 接口广播
主动备份配置
网卡设置的轮询机制####
1.
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.128/24
####
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0
##
ifconfig eth0 down #####设定某个网卡停止工作
2.Team 和 bond0 功能类似
• Team 不需要手动加载相应内核模块
• Team 有更强的拓展性
– 支持 8 快网卡
nmcli connection add con-name team0 ifname team0 type team cnfig ''ip4
3.对网桥的管理
nm-co***##先删除网卡
brctl addbr br0##添加网桥
brctl show##显示网桥
brctl addif br0 eth0##把br0搭在eth0上面
ifconfig br0 172.25.254.114 netmask 255.255.255.0##对网桥进行配置
ping 172.25.254.250##可以ping通
brctl delif br0 eth0##把br0从eth0上面移除
然后ping 172.25.254.250
ifconfig br0 down ##把br0ifconfig中移除
brctl delbr br0##删除网桥
- 第十一次笔记
- 第十一次笔记
- 第十一次java课后笔记
- C指针编程之道 ---第十一次笔记
- 第十一次课后作业
- 第十一次课后作业
- 第十一次课后作业
- 第十一次课后作业
- 第十一次课后作业
- 第十一次课堂作业
- 第十一次课后作业
- 第十一次上机报告
- 第十一次实验任务
- 第十一次实验任务
- 第十一次上机实验
- 第十一次试验任务
- 第十一次上机实验
- 第十一次实验任务
- 面试中排序算法问题
- Spring框架体系简介
- bat文件实现修改IP和DNS
- SpringMVC架构及源码分析
- bug处理情况填表
- 第十一次笔记
- sql知识,不定时更新
- 打印两个有序链表的公共部分
- network
- Python ast 学习笔记1–手动建ast
- ArcEngine要素闪烁
- HDOJ_1008电梯上的时间(Elevator)
- Python print 输出到文件(open)
- 2017-3-10 SQLserver增,删,改,查语句,主外键约束