Patent ID: 8761170

Claim:
A communication device which communicates with a server device connected to the Internet, via (i) an upper layer Network Address Translation (NAT) device connected to the Internet and (ii) a lower layer NAT device connected to the upper layer NAT device, the communication device comprising: a connection environment check unit configured to collect information indicating a Local Area Network (LAN)-side Internet Protocol (IP) address of the upper layer NAT device and information indicating a Wide Area Network (WAN)-side IP address of the lower layer NAT device; a determination purpose port mapping command unit configured to issue a port mapping command for the lower layer NAT device to transfer a packet to the communication device, the packet arriving at a predetermined port number of the lower layer NAT device; a determination packet generation unit configured to generate a determination packet which is source-routed, the determination packet generation unit including: a relay destination determination unit configured to determine, as a relay destination of the determination packet, the LAN-side IP address of the upper layer NAT device collected by the connection environment check unit; a final destination determination unit configured to determine, as a final destination of the determination packet, the WAN-side IP address of the lower layer NAT device collected by the connection environment check unit; and a destination port determination unit configured to determine, as a destination port number of the determination packet, a same port number as the predetermined port number used for the port mapping command; a determination packet transmitting unit configured to transmit the determination packet generated by the determination packet generation unit; a determination packet receiving unit configured to receive the determination packet which is transmitted from the determination packet transmitting unit, the determination packet being received by passing through the upper layer NAT device and the lower layer NAT device, and arriving at the communication device; and a port number obtainment unit configured to obtain a WAN-side port number of the lower layer NAT device which is a source port number indicated in the determination packet received by the determination packet receiving unit.