Determine the NAT type based on Nat stun

Source: Internet
Author: User

Determining the NAT type

Download and install twisted and Zope
Http://twistedmatrix.com/trac/wiki/Downloads
Http://pypi.python.org/pypi/zope.interface/3.8.0#downloads

Download stunclient
Http://code.google.com/p/stunclient/

There is a subdirectory named stun, which is used to find the NAT type.
This Code comes from shtoom: http://divmod.org/projects/shtoom

Execute the stun. py file to log a file.On my computer)

01:23:30 [-] log opened.
01:23:30 [-] <class '_ main _. teststundiscoveryprotocol'> starting on 5061
01:23:30 [-] Starting protocol <__main _. teststundiscoveryprotocol object at 0x00edb190>
01:23:30 [-] startdiscover -- localaddress is 0.0.0.0
01:23:30 [-] localaddress is invalid!
01:23:30 [-] resolving A.ROOT-SERVERS.NET
01:23:30 [-] connecting UDP socket to 198.41.0.4
01:23:30 [-] Twisted. Internet. Protocol. datagramprotocol starting on 57131
01:23:30 [-] Starting protocol <twisted. Internet. Protocol. datagramprotocol instance at 0x00ee3828>
01:23:30 [-] connected UDP socket says 192.168.1.100
01:23:30 [-] (Port 57131 closed)
01:23:30 [-] stopping protocol <twisted. Internet. Protocol. datagramprotocol instance at 0x00ee3828>
01:23:30 [-] sending request 'bbf2c488eedcba1863238b76fbbdb1a 'with 1 avpairs to ('2017. 146.35.99', 216) (In State 1)
01:23:30 [-] sending request 'bcffaf59142c3cf2575d2fb6f06424' with 1 avpairs to ('192.59.75 ', 213) (In State 1)
01:23:30 [-] sending request '26e9d0804bc12a4037aa59ccbd75e49 'with 1 avpairs to ('192. 98.81.87', 192) (In State 1)
01:23:30 [-] sending request 'bbf2c488eedcba1863238b76fbbdb1a 'with 1 avpairs to ('2017. 146.35.99', 216) (In State 1)
01:23:30 [-] sending request 'bcffaf59142c3cf2575d2fb6f06424' with 1 avpairs to ('192.59.75 ', 213) (In State 1)
01:23:30 [-] sending request '26e9d0804bc12a4037aa59ccbd75e49 'with 1 avpairs to ('192. 98.81.87', 192) (In State 1)
01:23:30 [-] sending request 'bbf2c488eedcba1863238b76fbbdb1a 'with 1 avpairs to ('2017. 146.35.99', 216) (In State 1)
01:23:30 [-] sending request 'bcffaf59142c3cf2575d2fb6f06424' with 1 avpairs to ('192.59.75 ', 213) (In State 1)
01:23:30 [-] sending request '26e9d0804bc12a4037aa59ccbd75e49 'with 1 avpairs to ('192. 98.81.87', 192) (In State 1)
01:23:30 [stun] Got stun response to none from ('192.59.75 ', 213)
At 01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] mapped-address 116.48.48.225 14959
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] changed-address 213.192.59.93 3479
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] source-address 213.192.59.75 3478
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] sending request 'hangzhou' with 1 avpairs to ('192.59.75 ', 213) (In State 2b)
01:23:30 [stun] Ignoring belated stun response to 'bcffaf59142c3cf2575d2fb6f06424 'from ('192.59.75', 213)
01:23:30 [-] sending request '1fd789b6d02e4be456597e8be1df4a7a 'with 1 avpairs to ('192.59.75', 213) (In State 2b)
01:23:30 [stun] Ignoring belated stun response to 'bcffaf59142c3cf2575d2fb6f06424 'from ('192.59.75', 213)
01:23:30 [-] sending request '1fd789b6d02e4be456597e8be1df4a7a 'with 1 avpairs to ('192.59.75', 213) (In State 2b)
01:23:30 [stun] Got stun response to '1fd789b6d02e4be456597e8be1df4a7a 'from ('192.59.93', 213)
At 01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] mapped-address 116.48.48.225 14959
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] changed-address 213.192.59.93 3479
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] source-address 213.192.59.93 3479
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] Calling handlestunstate2b
01:23:30 [_ main __. teststundiscoveryprotocol (UDP)] 2B {'externaladdress': ('2017. 48.48.225 ', 14959),' _ altstunaddress ': ('2017. 192.59.93 ', 3479 )}
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] Stun finished, Results:
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] you're behind a <nattype fullcone>
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] and external address is ('192. 48.48.225 ', 116)
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] (Port 5061 closed)
01:23:30 [_ main _. teststundiscoveryprotocol (UDP)] stopping protocol <__main _. teststundiscoveryprotocol object at 0x00edb190>
01:23:30 [-] Main Loop terminated.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.