目录
2.指定在2023/03/30 19:00将时间写入testmail.txt文件中
3.指定在每天凌晨4:00将该时间点之前的系统日志信息备份到个目录下(/var/log/messages ),备份后日志文件名显示格式logfileYY-MM-DD HH-MM
1.atd和crond两个任务管理程序的区别
atd是一次性作业,仅处理执行一次就结束
crond是周期性作业,每隔一点的周期就需要执行一次
2.指定在2023/03/30 19:00将时间写入testmail.txt文件中
3.指定在每天凌晨4:00将该时间点之前的系统日志信息备份到个目录下(/var/log/messages ),备份后日志文件名显示格式logfileYY-MM-DD HH-MM
进入文件crontab编辑:
[root@bogon ~]# vim /etc/crontab
4.在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作
【1】在关机状态下添加两块网卡
【2】网卡连接会话
【3】创建虚拟网卡
[root@bogon ~]# nmcli connection add type team ifname team0 con-name team0 config '{"runner":{"name":"activebackup"}}'
Connection 'team0' (c53b3bd0-d9c3-4f7c-80c1-04f72d9baa88) successfully added.
[root@bogon ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:da:54:4a brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 192.168.111.129/24 brd 192.168.111.255 scope global dynamic noprefixroute ens160
valid_lft 1319sec preferred_lft 1319sec
inet6 fe80::20c:29ff:feda:544a/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:da:54:54 brd ff:ff:ff:ff:ff:ff
altname enp19s0
inet 192.168.111.132/24 brd 192.168.111.255 scope global dynamic noprefixroute ens224
valid_lft 679sec preferred_lft 679sec
inet6 fe80::5c44:9e14:a2ab:26b7/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: ens256: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:da:54:5e brd ff:ff:ff:ff:ff:ff
altname enp27s0
inet 192.168.111.133/24 brd 192.168.111.255 scope global dynamic noprefixroute ens256
valid_lft 708sec preferred_lft 708sec
inet6 fe80::6550:a8e7:a371:fed6/64 scope link noprefixroute
valid_lft forever preferred_lft forever# 虚拟网卡
5: team0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether ca:44:69:2b:71:86 brd ff:ff:ff:ff:ff:ff
【4】将虚拟网卡绑定到物理网卡
[root@bogon ~]# nmcli connection add type team-slave ifname ens224 con-name team0-port1 master team0
Connection 'team0-port1' (551c5060-e376-4bbe-bd11-3d371b6d0d6b) successfully added.
[root@bogon ~]# nmcli connection add type team-slave ifname ens256 con-name team0-port2 master team0
Connection 'team0-port2' (a5604f4e-4410-469d-b0ba-f07c61f94bea) successfully added.
【5】激活所有网卡(先激活从卡,后激活主卡)
[root@bogon ~]# nmcli connection up team0-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@bogon ~]# nmcli connection up team0-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@bogon ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
【6】查看激活状态
【7】查看当前会话的工作状态:teamdctl team0 stat
【8】我们接下里测试网关冗余,首先我们down掉其中的一个网卡
[root@bogon ~]# nmcli connection down team0-port1
Connection 'team0-port1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)
【9】然后再次查看当前会话的工作状态
从而实现我们的网关冗余。