The present invention relates to a home network system, in which devices constituting a home network can be installed to be provided with home network service, and can be controlled using various terminals, and to a method of controlling the home network system, method of setting a residential gateway and method of processing an event protocol for the home network system. In the home network system, an HNSN (100) includes a user/device information Database (130) for storing information about a user and electronic appliances, an HnsnRgIF (140) that is a process for performing registration, authentication and connection management for an RG, an HnsnUPnP (120) that is a process for performing device control and event control for the RG, and an application server (110) for analyzing requests and providing a control command to the HnsnUPnP, and transmitting a response to the control command to the user terminal.