diff --git a/server/src/com/cloud/network/router/NetworkHelperImpl.java b/server/src/com/cloud/network/router/NetworkHelperImpl.java index dd45e9f3d13..62dd7893abc 100644 --- a/server/src/com/cloud/network/router/NetworkHelperImpl.java +++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java @@ -623,12 +623,7 @@ public class NetworkHelperImpl implements NetworkHelper { networks.put(controlConfig, new ArrayList()); - // 2) Guest Network - final LinkedHashMap> guestNic = configureGuestNic(routerDeploymentDefinition); - // The guest nic has to be added after the Control Nic. - networks.putAll(guestNic); - - // 3) Public network + // 2) Public network if (routerDeploymentDefinition.isPublicNetwork()) { s_logger.debug("Adding nic for Virtual Router in Public network "); // if source nat service is supported by the network, get the source @@ -651,10 +646,7 @@ public class NetworkHelperImpl implements NetworkHelper { defaultNic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(sourceNatIp.getVlanTag())); defaultNic.setIsolationUri(IsolationType.Vlan.toUri(sourceNatIp.getVlanTag())); } - //If guest nic has already been addedd we will have 2 devices in the list. - if (networks.size() > 1) { - defaultNic.setDeviceId(2); - } + final NetworkOffering publicOffering = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemPublicNetwork).get(0); final List publicNetworks = _networkMgr.setupNetwork(s_systemAccount, publicOffering, routerDeploymentDefinition.getPlan(), null, null, false); final String publicIp = defaultNic.getIPv4Address(); @@ -668,6 +660,11 @@ public class NetworkHelperImpl implements NetworkHelper { networks.put(publicNetworks.get(0), new ArrayList(Arrays.asList(defaultNic))); } + // 3) Guest Network + final LinkedHashMap> guestNic = configureGuestNic(routerDeploymentDefinition); + // The guest nic has to be added after the Control and Public nics. + networks.putAll(guestNic); + return networks; }