threefoldtecharchive / 0-templates

0-robot templates
Apache License 2.0
1 stars 1 forks source link

Creating gateway with portforward, result target port same as source port in container info #226

Closed AhmedHanafy725 closed 5 years ago

AhmedHanafy725 commented 5 years ago
data={'hostname': 'b54e7f898708eeb7428a08', 'networks': [{'name': 'nat0', 'type': 'default', 'public': True, 'id': ''}, {'name': 'zerotier_nic', 'type': 'zerotier', 'id': '1d719394048f3525', 'ztClient': 'c3477dac9423a9cb64e8cb', 'public': False}], 'portforwards': [{'protocols': ['tcp'], 'srcport': 3568, 'srcnetwork': 'nat0', 'dstip': '10.147.18.114', 'dstport': 2801, 'name': 'myport'}, {'protocols': ['tcp'], 'srcport': 6000, 'srcnetwork': 'nat0', 'dstip': '10.147.18.114', 'dstport': 5000, 'name': 'portt'}], 'httpproxies': [], 'domain': '', 'certificates': [], 'routes': [], 'ztIdentity': ''}

steps:

1- create gateway with this data using (template: github.com/threefoldtech/0-templates/gateway/0.0.1) 2- get gateway's container info

Actual Result

The target port is same as source port in container info port forward from public network to private one (did it twice on these ports 6000, 3568 to make sure)

image

muhamadazmy commented 5 years ago

Clearing a miss-understanding on the gateway port-forwards

So from what I see, this looks correct. To validate, run nft list ruleset inside the container to check that those ports are reforwarded to the requested destination.

@grimpy please confirm

AhmedHanafy725 commented 5 years ago

Yes, I found the rule inside the container. image and this rule in the node image and I had a server running on10.147.18.196:2856 so I was expecting to reach the server through10.2.20.4:3176, but this didn't happen