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)

相关推荐
哼?~5 小时前
NAT、代理服务、内网穿透
网络
茉莉玫瑰花茶6 小时前
工作流的常见模式 [ 1 ]
java·服务器·前端
kidwjb7 小时前
信号量在进程中的使用
linux·进程间通信
上海云盾-小余8 小时前
内网边界安全管控:访问权限隔离与入侵阻断方案
网络·安全·web安全
南京码讯光电技术有限公司8 小时前
工业无线AP选型指南:从WiFi 5到WiFi 6+5G CPE,如何构建全覆盖、零漫游、高可靠的智能工厂网络?
服务器·网络·5g
sulikey8 小时前
个人Linux操作系统学习笔记2 - gcc与库的理解
linux·笔记·学习·操作系统·gcc·
二宝哥9 小时前
Linux虚拟机网络配置
linux·运维·服务器
陳10309 小时前
Linux:进程间通信 和 简单进程池
linux·运维·服务器
优橙教育9 小时前
5G网络优化关键参数解读:从入门到实战
网络·学习·5g
jimy19 小时前
改.bashrc,直观地判断本地repo是否有改动
linux·服务器