Deploy NetScaler CPX in a Multi-Host Network
Topology 1: NetScaler CPX and Backend Servers on Same Host; Client on a Different Network
-
Configure the VIP on the NetScaler CPX container by using an additional IP address.
-
Configure an additional IP address for the Docker host.
-
Configure NAT rules to forward all traffic received on the Docker host’s additional IP address to the VIP’s additional IP address.
-
Configure the two servers as services on the NetScaler CPX instance.
-
Finally, bind the services to the VIP.
add service s1 172.17.0.10 HTTP 80
add service s2 172.17.0.11 HTTP 80
add lb vserver cpx-vip HTTP 172.17.4.100 80
bind lb vserver cpx-vip s1
bind lb vserver cpx-vip s2
ip addr add 10.102.29.103/24 dev eth0
iptables -t nat -A PREROUTING -p ip -d 10.102.29.103 -j DNAT --to-destination 172.17.4.100
-
Configure the VIP and the two services on the NetScaler CPX instance. Use a non-standard port, 81, with the VIP.
-
Bind the services to the VIP.
-
Configure a NAT rule to forward all traffic received on port 50000 of the Docker host to the VIP and port 81.
docker run -dt -p 22 -p 80 -p 161/udp -p 50000:81 --ulimit core=-1 --privileged=true cpx:6.2
add service s1 172.17.0.10 http 80
add service s2 172.17.0.11 http 80
add lb vserver cpx-vip HTTP 172.17.0.4 81
bind lb vserver cpx-vip s1
bind lb vserver cpx-vip s2
Topology 2: NetScaler CPX with Physical Servers and Client
docker run -dt -p 22 -p 80 -p 161/udp -p 8080:8080 --ulimit core=-1 --privileged=true cpx:6.2
add service s1 HTTP 10.102.29.105 80
add service s2 HTTP 10.102.29.110 80
add lb vserver cpx-vip HTTP 172.17.0.4 8080
bind lb vserver cpx-vip s1
bind lb vserver cpx-vip s2
Topology 3: NetScaler CPX and Servers Provisioned on Different Hosts
-
Set port mapping while creating your NetScaler CPX container. In this example, this means that you have to forward port 8080 on the container to port 8080 on the host. When the client request arrives on port 8080 of the host, it maps to port 8080 of the CPX container.
-
Configure the five servers as services on the NetScaler CPX instance. You have to use a combination of the respective Docker host IP address and mapped port to set these services.
-
Configure a VIP on the NetScaler CPX instance to receive the client request. This VIP should be represented by the NetScaler CPX IP address and port 8080 that was mapped to port 8080 of the host.
-
Finally, bind the services to the VIP.
docker run -dt -p 22 -p 80 -p 161/udp -p 8080:8080 --ulimit core=-1 --privileged=true cpx:6.2
add service s1 10.102.29.100 HTTP 8081
add service s2 10.102.29.105 HTTP 8081
add service s3 10.102.29.105 HTTP 8082
add service s4 10.102.29.110 HTTP 8081
add service s5 10.102.29.110 HTTP 8082
add lb vserver cpx-vip HTTP 172.17.0.2 8080
bind lb vserver cpx-vip s1
bind lb vserver cpx-vip s2
bind lb vserver cpx-vip s3
bind lb vserver cpx-vip s4
bind lb vserver cpx-vip s5