Linux 基础入门(八)邮件服务 swap分区 链路聚合

二 网络参数配置
方式一:nmtui

方式二:
1.设置永久设置主机名,修改/etc/hostname配置文件

[root@server0 ~]# echo A.tedu.cn > /etc/hostname
[root@server0 ~]# hostname
A.tedu.cn
[root@server0 ~]# exit
登出
Connection to 172.25.0.11 closed.
[student@room9pc01 ~]$ gos
Last login: Fri May 17 09:04:25 2019 from 172.25.0.250
[root@A ~]#

2.配置IP地址,子网掩码,网关地址

1)查看识别的网卡名称
[root@A ~]# nmcli connection show
名称
System eth0

2)修改IP地址,子网掩码,网关地址
]# nmcli connection modify ‘System eth0’
ipv4.method manual
ipv4.addresses ‘172.25.0.112/24 172.25.0.254’
connection.autoconnect yes

]# nmcli connection 修改 ‘识别的网卡名’
ipv4.方法 手工配置IP地址
ipv4.地址 ‘IP地址/子网掩码 网关地址’
每次开机自动启用

3)激活配置
[root@A ~]# ifconfig | head -2
[root@A ~]# nmcli connection up ‘System eth0’
######################################################
DNS服务器地址:将域名解析为对应的IP地址
/etc/resolv.conf #指定DNS服务器最终有效配置文件

]# echo ‘nameserver 172.25.254.254’ > /etc/resolv.conf

]# cat /etc/resolv.conf
nameserver 172.25.254.254

]# nslookup www0.example.com #测试域名解析
Server: 172.25.254.254
Address: 172.25.254.254#53

www0.example.com canonical name = server0.example.com.
Name: server0.example.com
Address: 172.25.0.11
#######################################################
配置IPv6地址

• IPv4 地址表示
– 32个二进制位,点分隔的十进制数
– 例如:172.25.0.11、127.0.0.1

• IPv6 地址表示
– 128个二进制位,冒号分隔的十六进制数
– 每段内连续的前置 0 可省略、连续的多个 : 可简化为 ::

– 例如: 2003:ac18:0000:0000:0000:0000:0000:0305
2003:ac18::305/64

1)查看识别的网卡名称
[root@A ~]# nmcli connection show
2)修改IP地址,子网掩码,网关地址
]# nmcli connection modify ‘System eth0’
ipv6.method manual
ipv6.addresses 2003:ac18::305/64
connection.autoconnect yes

]# nmcli connection 修改 ‘识别的网卡名’
ipv6.方法 手工配置IP地址
ipv6.地址 IP地址/子网掩码
每次开机自动启用

3)激活配置
[root@A ~]# ifconfig | head -4
[root@A ~]# nmcli connection up ‘System eth0’
[root@A ~]# ifconfig | head -4
[root@A ~]# ping6 2003:ac18::305
#########################################################
链路聚合(聚合链路 网卡绑定)

作用:提高网卡设备的可靠性,提供冗余

            eth1          eth2    
                 
                             虚拟网卡:team0 
                              192.168.1.1

1.建立虚拟网卡team0,参考 man teamd.conf 全文搜索 /example

]# nmcli connection add type team
con-name team0 ifname team0 autoconnect yes
config ‘{“runner”: {“name”: “activebackup”}}’

]# nmcli connection 添加 类型 team
配置文件名 team0 网卡名 team0 每次开机自动启用
链路聚合管理方式为 热备份方式

]# ifconfig #查看生成的虚拟网卡team0

生成配置文件位置:/etc/sysconfig/network-scripts/

2.添加成员
]# nmcli connection add type team-slave
con-name team0-1 ifname eth1 master team0

]# nmcli connection add type team-slave
con-name team0-2 ifname eth2 master team0

]# nmcli connection 添加 类型 team-成员
配置文件名 team0-1 网卡名 eth1 主设备为 team0

生成配置文件位置:/etc/sysconfig/network-scripts/

3.配置IP地址激活
[root@A ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses 192.168.1.1/24 connection.autoconnect yes

[root@A ~]# nmcli connection up team0 #激活配置

[root@A ~]# teamdctl team0 state #专用于查看team0信息
[root@A ~]# ifconfig eth2 down #禁用eth2网卡
[root@A ~]# teamdctl team0 state

如果无法激活,删除所有配置重新来过
[root@A ~]# nmcli connection delete team0
[root@A ~]# nmcli connection delete team0-1
[root@A ~]# nmcli connection delete team0-2

###################################################
parted分区工具,进行gpt分区模式

   128个主分区 最大空间支持18EB

[root@A ~]# parted /dev/vdb
(parted) mktable gpt #指定分区表类型为gpt
(parted) print #输出分区表信息
(parted) mkpart #划分新的分区
分区名称? []? haha #分区名称随意写
文件系统类型? [ext2]? ext4 #文件系统随意些,不起实际作用
起始点? 0 #分区起始点
结束点? 2G #分区结束点
警告: The resulting partition is not properly aligned
for best performance.
忽略/Ignore/放弃/Cancel? Ignore #选择ignore忽略
(parted) print
(parted) unit GB #使用GB最为单位
(parted) print
(parted) mkpart
分区名称? []? haha
文件系统类型? [ext2]? ext4
起始点? 2G
结束点? 5G
(parted) print
(parted) quit
###################################################
基础邮件服务

邮件域名:
server0.example.com

邮箱帐号:
yg@server0.example.com

• 电子邮件服务器的基本功能
– 为用户提供电子邮箱存储空间(用户名@邮件域名)
– 处理用户发出的邮件 —— 传递给收件服务器
– 处理用户收到的邮件 —— 投递到邮箱

快速部署postfix邮件服务器
1.装postfix软件包
[root@A ~]# rpm -q postfix
postfix-2.10.1-6.el7.x86_64

2.修改配置文件/etc/postfix/main.cf
vim末行模式 :set nu #开启行号

99 myorigin = server0.example.com #默认补全域名后缀

116 inet_interfaces = all #允许本机所有网卡提供邮件服务

164 mydestination = server0.example.com #此值判断为本域邮件

3.重启服务
[root@A ~]# systemctl restart postfix

测试邮件收发
[root@A ~]# useradd yg
[root@A ~]# useradd xln

•发信操作: mail -s ‘邮件标题’ -r 发件人 收件人
[root@A ~]# mail -s ‘test01’ -r yg xln
ahahxixihehelele
.
EOT
[root@A ~]# echo AAA | mail -s ‘test02’ -r yg xln

•收信操作: mail [-u 用户名]
[root@A ~]# mail -u xln

N 1 yg@server0.example.c Fri May 17 15:28 18/565
& 1 #输入邮件编号1回车查看邮件的内容

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

~上善若水~~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值