A relay device comprising: a first network interface for communicating with other devices in a first network ; a second network interface for communicating with a device in a second network (NT); a forwarding table storage storing association information associating an IP address of a first device and a port number in the first network with a port number of the second network (NT) to relay communication between the first device in the first network and a second device in the second network and with a protocol for transmitting and receiving data; and a relay control means configured to control the relay device to relay communication among the other devices in the first network and the second network (NT) in accordance with the association information and the IP addresses of the respective devices and the port numbers in the first network , wherein the relay control means is configured to dynamically change the association information on the basis of a state of the first device in the first network, characterized in that the relay control means is configured to, in a case where the association information does not identify a transfer destination of a request from a first port number of the second network: transfer (S50) the request to all devices in the first network ; return (S90, S120) a response to the request, received from a responding device of the devices in the first network, to the second network as a response to the request; and change (S100, S130) the association information by associating an IP address of the responding device as a source of the response and a port number in the first network with the first port number of the second network. a first network interface for communicating with other devices in a first network ; a second network interface for communicating with a device in a second network (NT); a forwarding table storage storing association information associating an IP address of a first device and a port number in the first network with a port number of the second network (NT) to relay communication between the first device in the first network and a second device in the second network and with a protocol for transmitting and receiving data; and a relay control means configured to control the relay device to relay communication among the other devices in the first network and the second network (NT) in accordance with the association information and the IP addresses of the respective devices and the port numbers in the first network , wherein the relay control means is configured to dynamically change the association information on the basis of a state of the first device in the first network, characterized in that the relay control means is configured to, in a case where the association information does not identify a transfer destination of a request from a first port number of the second network: transfer (S50) the request to all devices in the first network ; return (S90, S120) a response to the request, received from a responding device of the devices in the first network, to the second network as a response to the request; and change (S100, S130) the association information by associating an IP address of the responding device as a source of the response and a port number in the first network with the first port number of the second network. transfer (S50) the request to all devices in the first network ; return (S90, S120) a response to the request, received from a responding device of the devices in the first network, to the second network as a response to the request; and change (S100, S130) the association information by associating an IP address of the responding device as a source of the response and a port number in the first network with the first port number of the second network. <EOS>