When Germany declared war on the Netherlands and also started its war against other West-European nations, the Dutch navy gave the order for all submarines in the Dutch East Indies to protect the colony against possible attacks or raids by German or Italian auxiliary cruisers. At the same time, the Dutch navy also observed Japanese activity closely, especially after Japan had signed the Tripartite Pact with Italy and Germany. The "K XVII" was during this period mainly tasked with protecting merchant ships against raiders by either taking part in convoys or closely shadowing merchant ships. For example, on 15 September 1940 "K XVII" together with "O 16" shadowed the steamship "Lematang" and the tanker "Olivia" on their trip to Durban and Lourenço Marques. They had the order to keep their eyes open for German raiders and attack them if spotted. At the end of September 1940 "K XVII" also protected the steamship "Salando" of the Rotterdam company "Lloyd" when it made its way through the Soenda Strait to reach its destination, Durban.