A method for configuring a terminal device, wherein a mobile phone comprises a module for receiving and processing Provisioning Service, PS, message, a WiFi Protected Setup, WPS, register module and a configuration information storage area, and the terminal device comprises a Home Gateway, HGW, configuration processing module and an Access Point, AP, the method comprises: the module for receiving and processing PS message receiving a Provisioning Server, PS, message sent from a service provider device, extracting configuration information about the terminal device from the PS message, and decrypting the configuration information about the terminal device; the module for receiving and processing the PS message storing the configuration information about the terminal device into the configuration information storage area; the module for receiving and processing the PS message notifying the configuration information about the terminal device to the WPS register module, and indicating to the WPS register module a device ID corresponding to the configuration information about the terminal device and address for storing the configuration information about the terminal device; the AP sending a beacon frame to outside periodically after the terminal device is powered on by a user, wherein the beacon frame includes the device ID of the terminal device, and indicates that the AP supports a WPS configuration method but has never obtained any configuration by using a WPS method; the WPS register module receiving the beacon frame of the AP or finding existence of the AP through active probing, wherein if the WPS register module discovers an AP supporting the WPS and discovers that the AP allows the WPS register to configure it, the WPS register module asks the user whether to configure the AP, and if the user answers yes, then WPS register module performs configuration of the AP; the WPS register module reading configuration information about the terminal device from the configuration information storage area according to the device ID if the user agrees to configure the discovered AP, and getting ready for sending the configuration information about the terminal device together with configuration parameters for configuring the AP to the AP; and the WPS register module configuring the AP on the terminal device by using the WPS method, and transmitting the configuration information about the terminal device to the AP together with the configuration parameters for configuring the AP; and the AP receiving the configuration information about the terminal device and the configuration parameters for configuring the AP from the WPS register module, and forwarding the configuration information about the terminal device to the HGW configuration processing module. the module for receiving and processing PS message receiving a Provisioning Server, PS, message sent from a service provider device, extracting configuration information about the terminal device from the PS message, and decrypting the configuration information about the terminal device; the module for receiving and processing the PS message storing the configuration information about the terminal device into the configuration information storage area; the module for receiving and processing the PS message notifying the configuration information about the terminal device to the WPS register module, and indicating to the WPS register module a device ID corresponding to the configuration information about the terminal device and address for storing the configuration information about the terminal device; the AP sending a beacon frame to outside periodically after the terminal device is powered on by a user, wherein the beacon frame includes the device ID of the terminal device, and indicates that the AP supports a WPS configuration method but has never obtained any configuration by using a WPS method; the WPS register module receiving the beacon frame of the AP or finding existence of the AP through active probing, wherein if the WPS register module discovers an AP supporting the WPS and discovers that the AP allows the WPS register to configure it, the WPS register module asks the user whether to configure the AP, and if the user answers yes, then WPS register module performs configuration of the AP; the WPS register module reading configuration information about the terminal device from the configuration information storage area according to the device ID if the user agrees to configure the discovered AP, and getting ready for sending the configuration information about the terminal device together with configuration parameters for configuring the AP to the AP; and the WPS register module configuring the AP on the terminal device by using the WPS method, and transmitting the configuration information about the terminal device to the AP together with the configuration parameters for configuring the AP; and the AP receiving the configuration information about the terminal device and the configuration parameters for configuring the AP from the WPS register module, and forwarding the configuration information about the terminal device to the HGW configuration processing module.