hi, i am using pystun to detect NAT type.When i switch NAT type to Restric cone NAT using iptables commands.it will get NAT types is Port Restric Cone NAT.and i use STUN server website :stun.pjsip.org.
But,when i modify get_nat_type function in 257 lines :
log.debug("Do Test3")
ret = stun_test(s, changedIP, port, source_ip, source_port,
changePortRequest)
modified:
log.debug("Do Test3")
ret = stun_test(s, stun_host, port, source_ip, source_port,
changePortRequest)
it can detect to Restric Cone NAT.i think iptables will accept data when the ip and port had linked ,also it has not overtime.
more information:
iptables config:
[docker@host TUTK]$ sudo iptables-save
# Generated by iptables-save v1.4.21 on Mon Feb 5 17:23:56 2018
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -i eth0 -j DNAT --to-destination 172.17.0.5
-A POSTROUTING -o eth0 -j SNAT --to-source 66.112.215.237
COMMIT
# Completed on Mon Feb 5 17:23:56 2018
# Generated by iptables-save v1.4.21 on Mon Feb 5 17:23:56 2018
*filter
:INPUT ACCEPT [10:768]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6:704]
-A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 139.162.62.29/32 -j ACCEPT
-A FORWARD -d 172.17.0.5/32 -m state --state NEW -j DROP
COMMIT
# Completed on Mon Feb 5 17:23:56 2018
hi, i am using pystun to detect NAT type.When i switch NAT type to Restric cone NAT using iptables commands.it will get NAT types is Port Restric Cone NAT.and i use STUN server website :stun.pjsip.org. But,when i modify get_nat_type function in 257 lines :
modified:
it can detect to Restric Cone NAT.i think iptables will accept data when the ip and port had linked ,also it has not overtime. more information: iptables config:
modified: