Index: fedd/federation/access.py
===================================================================
--- fedd/federation/access.py	(revision 47088755dd78e32a185cba5a3b1931db4b1f05af)
+++ fedd/federation/access.py	(revision 76c43e4e140afec9d809e8fd26767778ee6223fb)
@@ -95,4 +95,6 @@
             self.cert_file = config.get("globals", "cert_file")
             self.sert_pwd = config.get("globals", "cert_pw")
+
+	self.nat_portal = None
 
         self.trusted_certs = config.get("access", "trusted_certs") or \
@@ -490,4 +492,7 @@
 		'value': self.dragon_vlans})
 
+	if self.nat_portal is not None:
+	    msg['fedAttr'].append({'attribute': 'nat_portals', 'value': True})
+
 	if services:
 	    msg['service'] = services
@@ -626,4 +631,5 @@
 
 	    active = info.get('active', 'False')
+	    nat_partner = info.get('nat_partner', 'False')
 
 	    cfn = "%s/%s.gw.conf" % (tmpdir, myname.lower())
@@ -638,4 +644,7 @@
 				if s.get('name', "") in self.imports]:
 			    server_service_out[s['name']](f, s)
+
+		if nat_partner == 'True':
+		    print >>f, "nat_partner: True"
 
 		if tunnelconfig:
Index: fedd/federation/emulab_access.py
===================================================================
--- fedd/federation/emulab_access.py	(revision 47088755dd78e32a185cba5a3b1931db4b1f05af)
+++ fedd/federation/emulab_access.py	(revision 76c43e4e140afec9d809e8fd26767778ee6223fb)
@@ -90,4 +90,5 @@
 	self.portal_startcommand = config.get("access", "portal_startcommand")
 	self.node_startcommand = config.get("access", "node_startcommand")
+	self.nat_portal = config.get("access", "nat_portal")
 
 	self.uri = 'https://%s:%d' % (socket.getfqdn(), 
@@ -552,10 +553,16 @@
 		    k = p.get('key', None)
 		    surl = p.get('store', None)
-		    if surl and k and k.index('/') != -1:
-			value = "%s.%s.%s%s" % \
+		    if surl :
+			if self.nat_portal:
+			    value = self.nat_portal
+			elif k and k.index('/') != -1:
+			    value = "%s.%s.%s%s" % \
 				(k[k.index('/')+1:], ename, proj, self.domain)
-			req = { 'name': k, 'value': value }
+			else: 
+			    self.log.error("Bad export request: %s" % p)
+			    continue
 			self.log.debug("Setting %s to %s on %s" % \
 				(k, value, surl))
+			req = { 'name': k, 'value': value }
 			self.call_SetValue(surl, req, cf)
 		    else:
Index: fedd/federation/experiment_control.py
===================================================================
--- fedd/federation/experiment_control.py	(revision 47088755dd78e32a185cba5a3b1931db4b1f05af)
+++ fedd/federation/experiment_control.py	(revision 76c43e4e140afec9d809e8fd26767778ee6223fb)
@@ -327,5 +327,4 @@
 
         self.tbmap = { }
-	self.tbactive = set()
         lineno =0
         try:
@@ -338,11 +337,5 @@
                 try:
                     label, url = line.split(':', 1)
-		    if ',' in label:
-			label, act = label.split(',', 1)
-			active = (act.strip() == 'active')
-		    else:
-			active = False
                     self.tbmap[label] = url
-		    if active: self.tbactive.add(label)
                 except ValueError, e:
                     self.log.warn("[read_mapdb] Ignored bad line (%d) in " +\
@@ -2169,9 +2162,7 @@
 	# of the testbed map.
 	tbmap = dict(self.tbmap)
-	tbactive = set(self.tbactive)
 	for m in req.get('testbedmap', []):
 	    if 'testbed' in m and 'uri' in m:
 		tbmap[m['testbed']] = m['uri']
-		if 'active' in m and m['active']: tbactive.add(m['testbed'])
 
 	# a place to work
@@ -2213,8 +2204,13 @@
 	    connInfo = { }	    # Connection information
 
-	    self.split_topology(top, topo, testbeds)
-
 	    self.get_access_to_testbeds(testbeds, fid, allocated, 
 		    tbparams, masters, tbmap, expid, expcert_file)
+
+	    # tbactive is the set of testbeds that have NATs in front of their
+	    # portals. They need to initiate connections.
+	    tbactive = set([k for k, v in tbparams.items() \
+		    if v.get_attribute('nat_portals')])
+
+	    self.split_topology(top, topo, testbeds)
 
 	    attrs = self.generate_keys_and_hosts(tmpdir, expid, hosts, tbparams)
Index: fedd/federation/experiment_partition.py
===================================================================
--- fedd/federation/experiment_partition.py	(revision 47088755dd78e32a185cba5a3b1931db4b1f05af)
+++ fedd/federation/experiment_partition.py	(revision 76c43e4e140afec9d809e8fd26767778ee6223fb)
@@ -93,9 +93,12 @@
 		( st not in self.tbactive and dt in self.tbactive ):
 	    active = ("%s" % (st in self.tbactive))
+	    nat_partner = ("%s" % (dt in self.tbactive))
 	elif (st in masters and dt not in masters) or \
 		( st not in masters and dt in masters ):
 	    active = ("%s" % (st in masters))
+	    nat_partner = "%s" % False
 	else:
 	    active = ("%s" % (st > dt))
+	    nat_partner = "%s" % False
 
 	ifaces = [ ]
@@ -127,4 +130,5 @@
 				"%s/%s" % (mproject, eid)},
 			    { 'attribute': 'active', 'value': active},
+			    { 'attribute': 'nat_partner', 'value': nat_partner},
 			    # Move to SMB service description
 			    { 'attribute': 'masteruser', 'value': muser},
