diff --git a/EduNetworkBuilder/NetworkDevice.cs b/EduNetworkBuilder/NetworkDevice.cs index 6cc5adc..e912b6b 100644 --- a/EduNetworkBuilder/NetworkDevice.cs +++ b/EduNetworkBuilder/NetworkDevice.cs @@ -2977,7 +2977,26 @@ namespace EduNetworkBuilder public IPAddress LookupDHCPLease(string MAC, IPAddress NIC_IP) { IPAddress gateway; - if (myType != NetworkComponentType.firewall) + NetworkComponentType NCT = myType; + if(myType == NetworkComponentType.wrouter) + { + //If we are a wireless router, we could be set up as an access point, or as a router/firewall + //If the default gateway is on the LAN, we use the gateway. If the default gateway is on the WAN, + //We use the IP of the firewall IP. (NIC_IP) + IPAddress tGateway = GetGateway(); + NetworkCard lNic = LocalNic(tGateway); + if(lNic != null && lNic.GetNicType == NicType.wan) + { + //The gateway is on the WAN. We will give it our own IP as if we are a firewall + NCT = NetworkComponentType.firewall; + } + else + { + //The gateway is on the LAN. We pretend we are an Access Point. + NCT = NetworkComponentType.wap; + } + } + if (NCT != NetworkComponentType.firewall) { gateway = GetGateway(); }