如果您想强制执行 IP 表规则,那么是的,您需要选中该Restrict network access to cloud endpoint
框。此时,您将添加要强制执行的规则,例如:(192.0.0.1
9000
单个 IP 和端口)、 192.0.0.1-192.0.0.5
5000:5005
(IP 范围和端口范围)或其中的任何组合。
如果您使用 cURL 创建您的私人目的地,您可以使用如下命令:
curl "https://sgmanager.ng.bluemix.net/v1/sgconfig/<gateway_id>/destinations" \
-H "Authorization: Bearer <security_token>" \
-H "Content-type: application/json" \
-d '{"desc":"My Private Destination","ip":"1.1.1.1","port":8000,"private":true}' -k
创建私有目标后,您可以使用以下命令添加 IP 表规则:
curl -X PUT "https://sgmanager.ng.bluemix.net/v1/sgconfig/<gateway_id>/destinations/<destination_id>/ipTableRule" \
-H "Authorization: Bearer <security_token>" \
-H "Content-type: application/json" \
-d '{"src":"192.0.0.1","spt":"9000"}' -k
和
curl -X PUT "https://sgmanager.ng.bluemix.net/v1/sgconfig/<gateway_id>/destinations/<destination_id>/ipTableRule" \
-H "Authorization: Bearer <security_token>" \
-H "Content-type: application/json" \
-d '{"src_range":"192.0.0.1-192.0.0.5","spt":"5000:5005"}' -k
请注意,这里的第一个命令src
用于提供单个 IP,而第二个命令用于src_range
提供一系列 IP。