+
+# external nodes and links
+#
+EXTERNAL_LINKS := $(filter $(foreach host,$(EXTERNAL_HOSTS),%-$(host)),$(LINKS))
+
+$(foreach host,$(EXTERNAL_HOSTS),sshcheck-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),ovsversion-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),showdpid-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),showmac-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),showports-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),update-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),del-controller-$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),cache/status.$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),cache/db.$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),cache/bridge.$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),cache/switch.$(host)): ;
+$(foreach host,$(EXTERNAL_HOSTS),cache/controller.$(host)): ;
+$(foreach link,$(EXTERNAL_LINKS),cache/iface.$(link)@2): ;
+$(foreach link,$(EXTERNAL_LINKS),cache/endpoint.$(link)@2): ;
+
+# we assume that a program called tunproxy is available on the
+# external nodes.
+
+.SECONDEXPANSION:
+$(foreach link,$(EXTERNAL_LINKS),cache/port.$(link)@2): cache/port.%@2: cache/port.%@1 cache/host.$$(call leftnode,%)
+ @#echo $* [$<] [$^] $(call rightnode,$*)
+ @echo $(call default,EXTERNAL_PORT,$(call rightnode,$*)) > $@
+ @echo "===>" $(call rightnode,$*): \
+ ./tunproxy -t $$(cat cache/host.$(call leftnode,$*)):$$(cat cache/port.$*@1) \
+ -p $(call default,EXTERNAL_PORT,$(call rightnode,$*)) -e -d
+