iqiyi / dpvs

DPVS is a high performance Layer-4 load balancer based on DPDK.
Other
3.04k stars 730 forks source link

Keepalived 在带VLAN的配置下。不通 #233

Open taylor3768 opened 6 years ago

taylor3768 commented 6 years ago

keepalived的配置如下:

! Configuration File for keepalived

global_defs { notification_email { foo@example.com } notification_email_from bar@example.com smtp_server 1.2.3.4 smtp_connect_timeout 60 router_id DPVS_DEVEL }

local_address_group laddr_g1 { 10.152.57.173 dpdk0.845 # use DPDK interface 10.152.57.174 dpdk0.845 # use DPDK interface }

vrrp_instance VI_1 { state MASTER # master interface dpdk0.845.kni # should be kni interface dpdk_interface dpdk0.845 # should be DPDK interface virtual_router_id 123 # VID should be unique in network priority 100 # master's priority is bigger than worker advert_int 1 authentication { auth_type PASS auth_pass **** }

virtual_ipaddress {
    10.152.57.175
}

}

virtual_server_group 10.152.57.175-90 { 10.152.57.175 90 }

virtual_server group 10.152.57.175-90 { delay_loop 3 lb_algo rr # scheduling algorithm Round-Robin lb_kind FNAT # Forwarding Mode Full-NAT protocol TCP # Protocol TCP

laddr_group_name laddr_g1   # Local IP group-ID

real_server 10.152.57.172 90 { # real-server
    weight 100
    inhibit_on_failure
    TCP_CHECK {    # health check
        nb_sock_retry 2
        connect_timeout 3
        connect_port 90
    }
}
}

}

启动脚本如下

./dpvs& 手动添加VLAN再启动keepalived:./dpip vlan add dpdk0.845 link dpdk0 proto 802.1q id 845 ./keepalived -f /etc/keepalived/keepalived.conf

MASTER: ./dpip addr add 10.152.57.175/32 dev dpdk0.845 ./dpip route add 10.152.57.0/24 dev dpdk0.845

修改kni信息

VIP添加到KNI接口:ip addr add 10.152.57.175/32 dev dpdk0.845.kni ip route add default via 10.152.57.175/32 dev dpdk0.845.kni ip link set dpdk0.845.kni up

RS配置如下

启动服务:python -m SimpleHTTPServer 90 & 添加默认路由指向LIP:route add default gw 10.152.57.173

现在RS能ping通VIP10.152.57.175,但是curl 10.152.57.175:90的时候,显示 curl: (7) Failed connect to 10.152.57.175:90; No route to host

哪位大神解答下,是VLAN配置有问题,还是?

beacer commented 6 years ago

从哪里curl,想是client本身的路由问题? 在client上ip route get 10.152.57.175看看,或者看看client的路由表。

taylor3768 commented 6 years ago

@beacer 从master,slave,RS分别curl 10.152.57.175:90都不行 RS上: ip route get 10.152.57.175 10.152.57.175 dev bond4.845 src 10.152.57.172 cache

master和slave:ip route get 10.152.57.175 local 10.152.57.175 dev lo src 10.152.57.175 cache