[Release / Tutorial] NAT Traversing via UPnP

Results 1 to 7 of 7
  1. #1
    JavaScript Is Best Script Jash is offline
    MemberRank
    Dec 2010 Join Date
    SingaporeLocation
    683Posts

    [Release / Tutorial] NAT Traversing via UPnP

    Introduction to UPnP (From Wikipedia) :
    Spoiler:

    Universal Plug and Play (UPnP) is a set of networking protocols that permits networked devices, such as personal computers, printers, Internet gateways, Wi-Fi access points and mobile devices to seamlessly discover each other's presence on the network and establish functional network services for data sharing, communications, and entertainment. UPnP is intended primarily for residential networks without enterprise class devices.

    The UPnP technology is promoted by the UPnP Forum. The UPnP Forum is a computer industry initiative to enable simple and robust connectivity to stand-alone devices and personal computers from many different vendors. The Forum consists of over eight hundred vendors involved in everything from consumer electronics to network computing.

    The concept of UPnP is an extension of plug-and-play, a technology for dynamically attaching devices directly to a computer, although UPnP is not directly related to the earlier plug-and-play technology. UPnP devices are "plug-and-play" in that when connected to a network they automatically establish working configurations with other devices.


    Introduction to NAT Traversing from Wikipedia:
    Spoiler:

    NAT traversal is a general term for techniques that establish and maintain Internet protocol connections traversing network address translation (NAT) gateways. Network address translation breaks end-to-end connectivity. Intercepting and modifying traffic can only be performed transparently in the absence of secure encryption and authentication. NAT traversal techniques are typically required for client-to-client networking applications, especially peer-to-peer and Voice over IP (VoIP) deployments. Many techniques exist, but no single method works in every situation since NAT behavior is not standardized. Many NAT traversal techniques require assistance from a server at a publicly routable IP address. Some methods use the server only when establishing the connection, while others are based on relaying all data through it, which adds bandwidth costs and increases latency, detrimental to real-time voice and video communications.


    Right, so to summarize, this allows your program to port forward / map a port programmatic-ally on without having to manually access the firewall. What benefit does this bring? Here's a couple :
    Spoiler:

    1) No need for knowledge of credentials to access router to port forward
    2) No need to go through the pain of manually port forwarding on a router
    3) No need to create tutorials to help others to port forward
    4) No need for hamachi
    5) I'm sure there are many more


    Here's how to do it:
    Spoiler:

    Add a reference to the COM assembly "NATUPnP 1.0 Type Library." Then, you can access the collection of port mappings via UPnPNATClass. Here are a few examples.
    Code:
    IStaticPortMappingCollection mappings = (new UPnPNATClass()).StaticPortMappingCollection; // Fetches the collection of mappings
    mappings.Add(8484, "TCP", 8484, "192.168.1.101", true, "The Banana Program"); // Maps a port to external port 8484, protocol TCP, internal port 8484, internal client 192.168.1.101 with description "The Banana Program"
    mappings.Remove(8484, "TCP"); // Removes a port mapping with external port 8484 and protocol "TCP"


    Will be releasing a GUI and Command Line for port mapping separately.
    Last edited by Jash; 23-11-12 at 12:15 AM.


  2. #2
    JavaScript Is Best Script Jash is offline
    MemberRank
    Dec 2010 Join Date
    SingaporeLocation
    683Posts

    Re: [Release / Tutorial] NAT Traversing via UPnP

    Just found out a more elegant way for port mapping!
    However im too sleepy to do anything. Stay tuned for more updates!

  3. #3
    JavaScript Is Best Script Jash is offline
    MemberRank
    Dec 2010 Join Date
    SingaporeLocation
    683Posts

    Re: [Release / Tutorial] NAT Traversing via UPnP

    Updated!

  4. #4
    Chasing 99 Red Balloons Jordan is offline
    MemberRank
    Jan 2008 Join Date
    UKLocation
    1,763Posts

    Re: [Release / Tutorial] NAT Traversing via UPnP

    It would be interesting if somebody posted a TCP or UDP hole punching demo along similar lines to this since i know there often used in NAT traversal. :)

  5. #5
    Banned SilentThief is offline
    BannedRank
    Sep 2012 Join Date
    The MatrixLocation
    466Posts

    Re: [Release / Tutorial] NAT Traversing via UPnP

    Code:
    "The Banana Program"
    I trawled when I saw this. :P

  6. #6
    JavaScript Is Best Script Jash is offline
    MemberRank
    Dec 2010 Join Date
    SingaporeLocation
    683Posts

    Re: [Release / Tutorial] NAT Traversing via UPnP

    Quote Originally Posted by SilentThief View Post
    Code:
    "The Banana Program"
    I trawled when I saw this. :P
    What??? Where did you find this o.o i think i forgot to remove that

  7. #7
    Ī© -DefaulT is offline
    MemberRank
    Aug 2006 Join Date
    Emerald CityLocation
    1,429Posts

    Re: [Release / Tutorial] NAT Traversing via UPnP



    its in your code block.



Advertisement