I got the solution myself, as shown below: I added a new IP address in the sub-interface (eth0: 0) with my NAT IP address. For example, xxx.xx.xx.238 with eth0: 0. Now I added a new rule to IPTABLE as
$IPTABLES -t nat -A POSTROUTING -o eth0.0 -p tcp -d xxx.xx.xx.8 -j SNAT --to-source xxx.xx.xx.238
.
When accessing the application in IP xxx.xx.xx.8, it indicates that the NAT IP address should be xxx.xx.xx.238.
source share