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)

相关推荐
Edward1111111129 分钟前
4月28日防火墙问题
linux·运维·服务器
想学后端的前端工程师43 分钟前
【补充内外网突然不通的情况】
运维·服务器
Rust研习社1 小时前
使用 Axum 构建高性能异步 Web 服务
开发语言·前端·网络·后端·http·rust
灰子学技术1 小时前
Envoy HTTP 流量层面的 Metric 指标分析
网络·网络协议·http
上海云盾-小余1 小时前
海外恶意 UDP 攻击溯源:分层封禁策略与业务兼容平衡方案
网络·网络协议·udp
子琦啊1 小时前
【算法复习】字符串 | 两个底层直觉,吃透高频题
linux·运维·算法
智慧光迅AINOPOL1 小时前
校园全光网建设指南:从架构到调优,打造稳定高体验校园网络
网络·全光网解决方案·全光网·酒店全光解决方案·泛住宿全光网解决方案
被摘下的星星1 小时前
Internet 的域名系统:从“名字”到“地址”的翻译官
网络
跨境数据猎手2 小时前
跨境独立站系统技术拆解(附带源码)
服务器·前端·php