Docs
ulb
Classic Load Balancer CLB
Frequently Asked Questions
Related to usage
Do the VServer port and service node port have to be consistent?

Does the port of VServer and the port of the service node have to be consistent?

It’s not necessary to maintain consistency. If you want to implement packet forwarding listening port and backend server listening port inconsistency, you can achieve this by configuring the IpTables port forwarding rules in the service node. The specific steps are as follows:

  1. Modify the /etc/sysctl.conf configuration file and set net.ipv4.ip_forward = 1. The default is 0.
  2. Close the firewall service iptables stop.
  3. Set up the rules:
iptables -t nat -A PREROUTING –d $vip_ip -p tcp --dport $clb4_port -j DNAT --to-destination $vip_ip:$vm_port

Where: $vip_ip refers to the intranet service IP address of the load balancer, $clb4_port refers to the listening port of CLB, and $vm_port is the listening port of the backend server. For example, if the internal service IP address of the load balancer is: 10.10.10.10, CLB_4 listening port is 80, and the backend server listening port is 8101, then the rules are as follows:

iptables -t nat -A PREROUTING -d 10.10.10.10 -p tcp --dport 80 -j DNAT --to-destination 10.10.10.10:8101
  1. Save the configuration: service iptables save.
  2. Start iptables: service iptables start.