Now I am having a salt-master
behind an NAT, the master's 4505 and 4506 ports have been mapped to the 44505 and 44506 ports on the router.
There's a master_port
option but I think that only changes the port 4506 to 44506. How do I configure the minion to use 44505 instead of 4505 when connecting to this master?
Best Answer
Important update 10/14/2015:
It was my fault - my network was not good so some working methods may have been thought not working... I will keep my old answer, but it didn't seem correct - it failed after I rebooted both my minion and master.
What seems to work now is:
I put
publish_port: 44505
in the file/etc/salt/master
on the master, so salt opens port 44505 on the master now. Then I changed the port mapping configuration on the router, to map the router's port 44505 to master's port 44505 (instead of 4505).I don't know what the mechanism is, but it seems that the master can tell the minion which publish port to use, therefore the public port number on the router should be consistent with the local port number on the master.
Now my
/etc/salt/minion
configuration is just:The original answer which is WRONG:
I think I made it work by simply using the same
publish_port
option in the minion configuration file. I don't think it is mentioned on the documentation. It is NOT in the default/etc/salt/minion
configuration file either.Now my
/etc/salt/minion
configuration is like:Simply adding
publish_port: 44505
to the/etc/salt/master
configuration file on master does not make its minions connect to that publish port automatically. You will need to explicitly specify it in your minion configuration.