邮件服务
邮件服务的基本功能
1)为用户提供电子邮箱储存空间(用户名@邮件域名)
2)处理用户发出的邮件--------传递给收件的服务器
3)处理用户收到的邮件--------投递到邮箱
部署postfix邮件服务器
1.装包
[root@server0 ~]# yum -y install postfix #默认已经安装
[root@server0 ~]# rpm -q postfix #检测是否已经安装
postfix-2.10.1-6.el7.x86_64
2.配置
[root@server0 ~]# vim /etc/postfix/main.cf
myorigin = server0.example.com #默认补全域名后缀
inet_interfaces = all #在本机所有网卡均提供邮件功能
mydestination = server0.example.com #判断是否为本域邮件的依据
3.起服务
[root@server0 ~]# systemctl restart postfix
[root@server0 ~]# systemctl status postfix #查看服务报错信息
postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled)
Active: active (running) since 一 2019-12-16 09:59:24 CST; 3min 39s ago
mail收信操作:mail [-u 用户名]
mail发信:
mail -s ‘邮件标题’ -r 发件人 收件人[@域名]
mail收信:
mail -u 收件人
[root@server0 ~]# useradd zzz
[root@server0 ~]# useradd aaa
[root@server0 ~]# mail -s 'hahahahha' -r zzz aaa
yayayyayayayayyayayayyayaya
.
EOT
[root@server0 ~]# mail -u aaa
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/mail/aaa": 1 message 1 new
>N 1 zzz@server0.example. Mon Dec 16 10:11 18/602 "hahahahha"
& 1
Message 1:
From zzz@server0.example.com Mon Dec 16 10:11:22 2019
Return-Path: <zzz@server0.example.com>
X-Original-To: aaa
Delivered-To: aaa@server0.example.com
Date: Mon, 16 Dec 2019 10:11:22 +0800
From: zzz@server0.example.com
To: aaa@server0.example.com
Subject: hahahahha
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
Status: R
yayayyayayayayyayayayyayaya
& exit
[root@server0 ~]# echo 'dehf' | mail -s 'jhg' -r zzz aaa
[root@server0 ~]# mail -u aaa
N 2 zzz@server0.example. Mon Dec 16 10:13 18/573 "jhg"
& 2
交换空间(虚拟内存):
可以利用硬盘的空间,充当内存,缓解物理内存的压力.
作用:
1.划分新的分区,parted分区工具(专门用于划分GPT分区模式)
GPT分区模式:支持128个主分区,最大空间支持18EB
1EB=1024PB 1PB=1024TB
[root@server0 ~]# parted /dev/vdb
(parted) mktable gpt #制定分区表模式
(parted) print
Disk Flags:
Number Start End Size File system Name 标志
(parted) mkpart #划分新的分区
分区名称? []? haha #新的分区名,随便写
文件系统类型? [ext2]? ext4 #分区类型
起始点? 0
结束点? 2G
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? ignore
(parted) print
Disk Flags:
Number Start End Size File system Name 标志
1 17.4kB 2000MB 2000MB haha
2.格式化交换文件系统
mkswap 设备路径
[root@server0 ~]# mkswap /dev/vdb1
正在设置交换空间版本 1,大小 = 1953104 KiB
无标签,UUID=3afcf3cc-f2f4-4b99-8fa9-04843e433f82
[root@server0 ~]# mkswap /dev/vdb2
正在设置交换空间版本 1,大小 = 3905532 KiB
无标签,UUID=67c31ade-ff93-44cb-99aa-d62352c1c6c0
[root@server0 ~]# blkid /dev/vdb2
/dev/vdb2: UUID="67c31ade-ff93-44cb-99aa-d62352c1c6c0" TYPE="swap" PARTLABEL="hahhaha" PARTUUID="f80802f5-158a-4c4d-b02f-e99a152f5550"
[root@server0 ~]# blkid /dev/vdb1
/dev/vdb1: UUID="3afcf3cc-f2f4-4b99-8fa9-04843e433f82" TYPE="swap" PARTLABEL="haha" PARTUUID="b958f627-ee48-47e1-9cee-2f1496f78bd2"
3.启用交换分区
[root@server0 ~]# swapon /dev/vdb1 #启用交换分区
[root@server0 ~]# swapon -s #查看分区
文件名 类型 大小 已用 权限
/dev/vdb1 partition 1953104 0 -1
[root@server0 ~]# swapon /dev/vdb2
[root@server0 ~]# swapon -s
文件名 类型 大小 已用 权限
/dev/vdb1 partition 1953104 0 -1
/dev/vdb2 partition 3905532 0 -2
[root@server0 ~]# swapoff /dev/vdb2 #停用交换分区
[root@server0 ~]# swapon -s
文件名 类型 大小 已用 权限
/dev/vdb1 partition 1953104 0 -1
4.开机自动启用
[root@server0 ~]# vim /etc/fstab #修改配置文件开机自动挂载
/dev/vdb1 swap swap defaults 0 0
/dev/vdb2 swap swap defaults 0 0
[root@server0 ~]# swapon -a #专用于检测交换分区是否书写正确
[root@server0 ~]# swapon -s #查看分区
文件名 类型 大小 已用 权限
/dev/vdb1 partition 1953104 0 -1
/dev/vdb2 partition 3905532 0 -2
配置聚合链接(链路聚合)
作用:解决网卡的单点故障,备份网卡设备
热备份
team:由多块网卡一起组建成一个虚拟的网卡,即"组队"
作用:
轮询式(roudndribn)的流量负载均衡
热备份(activebackup)连接冗余
1.
[root@server0 ~]# nmcli 连接网络 添加 类型 team 网卡名 team0 配置文件名 team0 每次开机自动启用 工作方式 热备份方式
[root@server0 ~]# nmcli connection add type team ifname team0 con-name team0 autoconnect yes config '{"runner":{"name":"activebackup"}}'
Connection 'team0' (b44cf902-e616-47dc-98ff-b33a826590ec) successfully added.
[root@server0 ~]# ls /etc/sys
sysconfig/ sysctl.d/ system-release
sysctl.conf systemd/ system-release-cpe
[root@server0 ~]# ls /etc/sysconfig/network-scripts/ifcfg-team0 #生成的网卡配置文件
/etc/sysconfig/network-scripts/ifcfg-team0
[root@server0 ~]# ifconfig
team0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether c6:eb:09:3f:90:9f txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.添加成员
[root@server0 ~]# nmcli 连接网络 添加 类型 组队中从设备 网卡名 eth1 配置文件名 team0-1 每次开机自动启动 主设备为 team0
[root@server0 ~]# nmcli connection add type team-slave ifname eth1 con-name team0-1 autoconnect yes master team0
Connection 'team0-1' (93eeb9ad-9e75-4415-8bb2-544679a696db) successfully added.
[root@server0 ~]# nmcli connection add type team-slave ifname eth2 con-name team0-1 autoconnect yes master team0
Connection 'team0-1' (e5b053e0-fac9-4d07-a6a3-5bbab3399bb4) successfully added.
3.给team0配置IP地址
[root@server0 ~]# nmcli connection add type team-slave ifname eth1 con-name team0-1 autoconnect yes master team0 #为team0添加成员
Connection 'team0-1' (93eeb9ad-9e75-4415-8bb2-544679a696db) successfully added.
[root@server0 ~]# nmcli connection add type team-slave ifname eth2 con-name team0-2 autoconnect yes master team0 #为team0添加成员
Connection 'team0-2' (2c3bc08a-317c-46d1-8fcd-08f1a15868fe) successfully added.
[root@server0 ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses 192.168.1.1/24 connection.autoconnect yes #为team0配置IP地址
[root@server0 ~]# nmcli connection up team0 #激活team0网卡
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
[root@server0 ~]# nmcli connection up team0-1 #激活team0第一个成员
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@server0 ~]# nmcli connection up team0-2 #激活team0第二个成员
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
[root@server0 ~]# teamdctl team0 state #专用于查看team0信息
setup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
runner:
active port: eth1
配置IPv6地址
IPv4地址表示
32个二进制位,点分隔的十进制数,例如:172.25.0.11等
IPv6地址表示
128个二进制位位,冒号分隔的十六进制数,例如:2003:ac18:0000:0000:0000:0000:0000:0305
2003:ac18::305
[root@server0 ~]# nmcli connection modify 'System eth0' ipv6.method manual ipv6.addresses 2003:ac18::305/64 connection.autoconnect yes #配置ipv6地址
[root@server0 ~]# nmcli connection up 'System eth0' #激活ipv6地址
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)
[root@server0 ~]# ping6 2003:ac18::305 #ping ipv6格式
PING 2003:ac18::305(2003:ac18::305) 56 data bytes
64 bytes from 2003:ac18::305: icmp_seq=1 ttl=64 time=0.071 ms
64 bytes from 2003:ac18::305: icmp_seq=2 ttl=64 time=0.081 ms
64 bytes from 2003:ac18::305: icmp_seq=3 ttl=64 time=0.082 ms