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)

相关推荐
高旭的旭14 小时前
Ubuntu 无显示器远程桌面完美方案
linux·ubuntu·计算机外设
峥嵘life15 小时前
Android16 【CTS】CtsWindowManagerDeviceAnimations存在fail项
android·linux·学习
aiAIman15 小时前
OpenClaw 2026.3.12+ 外网访问云服务器完全指南
运维·服务器·开源·aigc
Oliver_LaVine15 小时前
Windows11使用VMware Workstation Pro 安装macOS Sonoma 14.4系统
网络
VermouthSp15 小时前
上下文切换
linux·rust
条tiao条15 小时前
从 “猜数字游戏” 入门 BST:C 语言从零实现与核心操作
c语言·网络·游戏
lichenyang45316 小时前
OSI(Open System interconnection)
网络
MinterFusion16 小时前
云主机服务单价 —— 评估云主机性价比的指标
网络·云主机·明德融创·价格评价·云主机服务单价·服务单价
我爱学习好爱好爱16 小时前
Logstash 数据管道测试案例:从 Filebeat 接收日志并输出至黑屏幕与 Elasticsearch(基于Rocky Linux 9.6)
大数据·linux·elasticsearch
桌面运维家16 小时前
Windows VHD虚拟磁盘技术详解与应用指南
linux·运维·服务器