keepalived 组播的配置

keepalived 组播的配置

准备主机2台

server hostname ip
keepalived s1 172.20.27.10
keepalived s2 172.20.27.11

S1节点配置

修改keepalived配置文件

[[email protected] ~]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
   notification_email {
        [email protected]
   }
   notification_email_from [email protected]
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id s1.mylinuxops.com
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_iptables
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface ens33
    virtual_router_id 27
    priority 100
    advert_int 2
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        172.20.27.100 dev ens33 label ens33:0
    }
}

启动服务

[[email protected] ~]# systemctl restart keepalived

查看vip是否绑定

[[email protected] ~]# ip a | grep ens33:0
    inet 172.20.27.100/32 scope global ens33:0

s2节点操作

修改keepalive的配置文件

[[email protected] ~]# vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
   notification_email {
        [email protected]
   }
   notification_email_from [email protected]
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id s2.mylinuxops.com
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_iptables
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state BACKUP
    interface ens33
    virtual_router_id 27
    priority 80
    advert_int 2
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        172.20.27.100 dev ens33 label ens33:0
    }
}

重启服务

[[email protected] ~]# systemctl start keepalived

抓包查看是否组播

在s1节点上抓包

[[email protected] ~]# tcpdump -i ens33:0 -nn net 224.0.0.18
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens33:0, link-type EN10MB (Ethernet), capture size 262144 bytes
18:59:35.835747 IP 172.20.27.10 > 224.0.0.18: VRRPv2, Advertisement, vrid 27, prio 100, authtype simple, intvl 2s, length 20
18:59:37.837171 IP 172.20.27.10 > 224.0.0.18: VRRPv2, Advertisement, vrid 27, prio 100, authtype simple, intvl 2s, length 20

抓到发往224.0.0.18的信息

测试keepalived

暂停s1的keepalived服务器查看地址是否会漂移到s2节点上
在s1节点上暂停服务

[[email protected] ~]# systemctl stop keepalived

在s2节点上查看VIP是否被移过来了

[[email protected] ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.27.11  netmask 255.255.0.0  broadcast 172.20.255.255
        inet6 fe80::20c:29ff:fe4d:1ce3  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:4d:1c:e3  txqueuelen 1000  (Ethernet)
        RX packets 21578  bytes 1824843 (1.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 311  bytes 28607 (27.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.27.100  netmask 255.255.255.255  broadcast 0.0.0.0
        ether 00:0c:29:4d:1c:e3  txqueuelen 1000  (Ethernet)
#VIP漂移到s2节点上了
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6  bytes 482 (482.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6  bytes 482 (482.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

再次启动s1节点查看是否地址是否被夺回

[[email protected] ~]# systemctl start keepalived
[[email protected] ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.27.10  netmask 255.255.0.0  broadcast 172.20.255.255
        inet6 fe80::20c:29ff:fec5:123c  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c5:12:3c  txqueuelen 1000  (Ethernet)
        RX packets 38095  bytes 2925087 (2.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28612  bytes 7301619 (6.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.27.100  netmask 255.255.255.255  broadcast 0.0.0.0
        ether 00:0c:29:c5:12:3c  txqueuelen 1000  (Ethernet)
# VIP地址再次被抢回去
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2  bytes 140 (140.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 140 (140.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

原文地址:https://blog.51cto.com/11886307/2406625

时间: 2024-11-07 04:52:02

keepalived 组播的配置的相关文章

keepalived组播故障排查

虚拟机无法接收keepalived的vrrp组播 现象: 在Ubuntu1404的系统下安装了三台虚拟机,然后配置了一个简单的keepalived+haproxy服务. 结果启动后发现三台虚拟机都配上vip,keepalived.log日志中也未看见error的报错信息. 排查过程: 这些典型的脑裂(split brain)现象,一般来说先检查配置文件是否配的有问题.注意下virtual_router_id 的值.两边是否一样. 然后就是大杀器tcpdump出马了. 首先分别在三台机器执行 tc

PIM-SM 协议无关组播-密集模式 未完

一.组播路由协议 (一) 路由器依靠转发项来转发组播数据包.转发项的生成则是组播路由协议所要完成的任务.组播路由协议有距离矢量组播路由协议(DVMRP).协议无关组播-密集模式(PIM-DM).协议无关组播-稀疏模式(PIM-SM).开放式组播最短路径优先(MOSPF).有核树组播路由协议(CBT)等多种.这里只讲述目前最成功也是最流行的PIM协议. 协议无关组播 PIM(协议无关组播)表示它不依赖于某种具体的IP路由选择协议.它仅仅是利用单播路由表来实现RPF校验功能.因此,它能工作在任何可以

55、组播配置实验之PIM Sparse Mode静态指定RP

1.PIM Sparse Mode简介 2.实验拓扑 3.基础配置 R1配置 interface Serial0/1 ip address 12.1.1.1 255.255.255.0 interface Serial0/2 ip address 14.1.1.1 255.255.255.0 interface FastEthernet1/0 ip address 13.1.1.1 255.255.255.0 router ospf 110 router-id 1.1.1.1 network 1

53、组播配置实验之解决二层组播

1.解决二层组播解析 2.实验拓扑 3.基础配置 IOU1配置 ip multicast-routing interface Ethernet0/0 ip address 192.168.1.1 255.255.255.0 ip pim sparse-mode IOU3配置 interface Ethernet0/0 ip address 192.168.1.3 255.255.255.0 ip igmp join-group 224.1.1.1 IOU4配置 interface Etherne

基于思科组播的VXLAN基本配置

基于思科组播的VXLAN基本配置 图一: 目的:基于组播的VXLAN基本配置,实现overlay网络夸三层的二层互通. 基础配置 接口配置: Spine(config)#interface loopback 0 Spine(config-if)#ip address10.0.0.1 255.255.255.255 Spine(config)#interface gigabitEthernet 0/1 Spine(config-if)#ip address 10.0.13.1 255.255.25

Linux rp_filter配置引起的组播断流问题

引子 前一段时间处理一个线上问题,服务器拉组播码流,但是每隔3-4分钟就断流一次,引起服务异常.排除了交换机和组播网络的问题后, 确认问题还是在服务器侧. 组播为什么断流? 前方工程人员抓包确认,交换机发送了igmp general query报文,但是服务器没有响应组播report报文,交换机上igmp条目超时退出,导致断流. 抓包分析如下: rp_filter配置对入向报文的影响 具体的排查过程就不再赘述了,这里只写结论:rp_filter配置影响了系统响应IGMP general quer

keepalived简单原理及配置参数介绍_2015101601

>>>keepalived是什么? keepalive是HA(High Available)高可用集群的一种实现方案,用来防止系统架构中的单点故障.其是vrrp协议的实现. >>>vrrp协议工作简介 vrrp(Virtual Router Redundancy Protocol),即是虚拟路由冗余协议.用于实现多个路由器的高可用性.其工作原理是将一组路由器虚拟成一个虚拟路由器对外提供一个或多个IP地址.在这组路由器当中,实际对外提供IP地址的路由器被称为MASTER,

LVS+Nginx(LVS + Keepalived + Nginx安装及配置)

(也可以每个nginx都挂在上所有的应用服务器) nginx大家都在用,估计也很熟悉了,在做负载均衡时很好用,安装简单.配置简单.相关材料也特别多. lvs是国内的章文嵩博士的大作,比nginx被广泛接受还要早7年,并且已经被红帽作为了系统内置软件,可谓很牛了.lvs相对于nginx来说配置上就要相对复杂一些. 但是,有时候我们会看到大牛们分享的经验里面是lvs+nginx作为负载均衡了,一直想不明白这是个什么道理. 为什么会出现两者被同时使用呢?其实,这要从两者的各自优势来说了. nginx用

架构设计:负载均衡层设计方案(7)——LVS + Keepalived + Nginx安装及配置

1.概述 上篇文章<架构设计:负载均衡层设计方案(6)--Nginx + Keepalived构建高可用的负载层>(http://blog.csdn.net/yinwenjie/article/details/47130609) 我们解说了Nginx的故障切换.而且承诺各位读者会尽快解说 LVS + Keepalived + Nginx的安装和配置.在中间由于工作的原因.我又插写了三篇关于zookeeper的原理使用的文章.今天这边文章我们回归主题.为各位读者解说LVS + Keepalive