Keepalived实验环境设定

1.环境设定图(示例)

2.环境设定

#部署rs1和rh2(单网卡NAT模式)

root@rs1 \~\]# vmset.sh eth0 xxx.xx.xx.xx rs1 \[root@rs1 \~\]# dnf install httpd -y \[root@rs1 \~\]# echo RS1 - xxx.xx.xx.xx \> /var/www/html/index.html \[root@rs1 \~\]# systemctl enable --now httpd rrss1 ![](https://i-blog.csdnimg.cn/direct/aad634ca7931429ca6ccfd9d35824e12.png) ![](https://i-blog.csdnimg.cn/direct/9dedd372e4e546dd9b849e45c441f3b8.png) rrss2 ![](https://i-blog.csdnimg.cn/direct/c537f14291994bc6b283a3cd3cec42ec.png) ![](https://i-blog.csdnimg.cn/direct/4191e0c316074df4bda5e31e74eb7b4e.png) #测试: ![](https://i-blog.csdnimg.cn/direct/02a198935b324980b94d441d89f2465a.png) ![](https://i-blog.csdnimg.cn/direct/f5d0a7fffb94473bbb2fe6210bba8680.png) #设定ka1和ka2 \[root@KA1 \~\]# vmset.sh eth0 xx.xx.xx.xx KA1 \[root@KA2 \~\]# vmset.sh eth0 xx.xx.xx.xx KA2 ![](https://i-blog.csdnimg.cn/direct/4108a478b96d4b1c9cec296dc1346eb1.png) ![](https://i-blog.csdnimg.cn/direct/fcd90268eff74b689f08082edf04fc9e.png) #设定本地解析 \[root@KA1 \~\]# vim /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 xx.xx.xx.xx KA1 xx.xx.xx.xx KA2 xx.xx.xx.xx rrss1 xx.xx.xx.xx rrss2 ![](https://i-blog.csdnimg.cn/direct/29e5c6fc2dc14b6896a4b380ce0998b7.png) \[root@KA1 \~\]# for i in 60 10 20 \> do \> scp /etc/hosts xx.xx.xx.xx.$i:/etc/hosts \> done ![](https://i-blog.csdnimg.cn/direct/6aa24ceef15940acae0c1423a74f96b7.png) #在其他主机中查看/etc/hosts ![](https://i-blog.csdnimg.cn/direct/0f8627b177764e4a99ef0c0508b18b52.png) #在ka1中开启时间同步服务 \[root@KA1 \~\]# vim /etc/chrony.conf 26 allow 0.0.0.0/0 29 local stratum 10 ![](https://i-blog.csdnimg.cn/direct/26a4034e4f924543bceeeaadbce50c93.png) \[root@KA1 \~\]# systemctl restart chronyd \[root@KA1 \~\]# systemctl enable --now chronyd ![](https://i-blog.csdnimg.cn/direct/ec4b58f444db44ea9b7432d5fe35155c.png) #在ka2中使用ka1的时间同步服务 \[root@KA2 \~\]# vim /etc/chrony.conf pool 192.168.186.50 iburst ![](https://i-blog.csdnimg.cn/direct/174100e858c14d978033e9b09e771260.png) \[root@KA2 \~\]# systemctl restart chronyd \[root@KA2 \~\]# systemctl enable --now chronyd ![](https://i-blog.csdnimg.cn/direct/96bb61d6bca64e36b320a6b314b50416.png) \[root@KA2 \~\]# chronyc sources -v ![](https://i-blog.csdnimg.cn/direct/3a1c3db05c3f4780b6d59825baae7570.png)

相关推荐
Genie cloud4 小时前
VPS 网络连接故障诊断与排查实用指南
linux·服务器·ssh
RisunJan4 小时前
Linux命令-lnstat(快速查找文件和目录)
linux·运维·服务器
滴水之功4 小时前
OpenWrt的WAN和LAN的切换
linux·网络·openwrt
lihui_cbdd4 小时前
Slurm 集群内存管理与限制配置
运维·服务器
历程里程碑4 小时前
Linux 17 程序地址空间
linux·运维·服务器·开发语言·数据结构·笔记·排序算法
CC.GG4 小时前
【Linux】进程控制(二)----进程程序替换、编写自主Shell命令行解释器(简易版)
linux·服务器·数据库
数研小生5 小时前
Full Analysis of Taobao Item Detail API taobao.item.get
java·服务器·前端
H Journey5 小时前
Linux 下添加用户相关
linux·运维·服务器·添加用户
莹莹学编程—成长记5 小时前
预备知识socket
网络