LVS-DR模式多網段的實現
阿新 • • 發佈:2021-07-15
一、系統架構
二、部署過程
1、基於https://www.cnblogs.com/lybj/p/15008009.html的實現
2、配置router伺服器
2.1、在eth0網絡卡上增加ip
[19:27:42 root@router ~]#ip a a 172.16.0.200/24 dev eth0:1 [19:32:32 root@router ~]#ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:fc:02:d2 brd ff:ff:ff:ff:ff:ff inet10.0.0.200/24 brd 10.0.0.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet 172.16.0.200/24 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fefc:2d2/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:fc:02:dc brd ff:ff:ff:ff:ff:ff inet 192.168.10.200/24 brd 192.168.10.255 scope global noprefixroute eth1 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fefc:2dc/64 scope link valid_lft forever preferred_lft forever
3、配置RS伺服器
3.1、配置VIP
[root@rs1 ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet 172.16.0.100/32 scope global lo:1 valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:15:5b:55 brd ff:ff:ff:ff:ff:ff inet 10.0.0.7/24 brd 10.0.0.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe15:5b55/64 scope link valid_lft forever preferred_lft forever
4、配置LVS伺服器
4.1、新增VIP
同3.1
4.2、配置叢集
[18:27:35 root@lvs ~]#ipvsadm -Ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 172.16.0.100:80 wrr -> 10.0.0.7:80 Route 1 0 0 -> 10.0.0.17:80 Route 1 0 0
5、驗證
[18:33:57 root@internet ~]#curl 172.16.0.100 rs2 10.0.0.17 [18:34:25 root@internet ~]#curl 172.16.0.100 rs1 10.0.0.7 [18:34:27 root@internet ~]#curl 172.16.0.100 rs2 10.0.0.17 [18:34:28 root@internet ~]#curl 172.16.0.100 rs1 10.0.0.7 [18:34:29 root@internet ~]#curl 172.16.0.100 rs2 10.0.0.17