محمود_9 0 Newbie Poster

I'm tring to do something called "Port Forwarding" using UPnP Com assemply in c# , the following code works fine and map new external ip and port number to my device , but it seems that the ip is not my correct external ip number , because it is different from the one I get in IP-lookup websites like (whatismyipaddress.com and whatismyip.com) .

this is my c# code (for the mapping) :

NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();
NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
mappings.Add(20000, "UDP", 20000, "192.168.8.102", true, "Local Web Server");
foreach (NATUPNPLib.IStaticPortMapping portMapping in mappings)
{
Console.WriteLine(portMapping.Description); //gives me "Local Web Server"
Console.WriteLine(portMapping.ExternalIPAddress); // gives me "10.178.196.123"
Console.WriteLine(portMapping.Enabled); // gives me "True"
}

in Ip-looking websites I got another external IP (46.32.126.221) , I tried to map my device with additional tools like UPnP Wizard and I got the same problem .

can you help me please ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.