这些规则可以缩短为一行吗:
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3050 -j DNAT --to-destination 192.168.1.3:3050
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3051 -j DNAT --to-destination 192.168.1.3:3051
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3052 -j DNAT --to-destination 192.168.1.3:3052
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3053 -j DNAT --to-destination 192.168.1.3:3053
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3054 -j DNAT --to-destination 192.168.1.3:3054
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3055 -j DNAT --to-destination 192.168.1.3:3055
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3056 -j DNAT --to-destination 192.168.1.3:3056
答案1
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3050:3056 -j DNAT --to-destination 192.168.1.3
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m multiport --dports 3050:3056,5000 -j DNAT --to-destination 192.168.1.3