The invention discloses a method for analyzing user online behavior and monitoring network quality on a home gateway. The method comprises the following steps of: A10, collecting user online data, analyzing a data packet access to a home gateway, generating a corresponding online behavior CSV (Comma Separated Value) file, and uploading to an FTP (File Transfer Protocol) server; A20, monitoring the network quality, simulating PPPOE (Point-to-Point Protocol over Ethernet) dialing periodically through the home gateway, initiatively starting TCP (Transmission Control Protocol), DNS (Domain Name Server), HTTP (Hyper Text Transport Protocol) and FTP (File Transfer Protocol) service availability detections, generating a corresponding network quality CSV file according to the detection result, and uploading to the FTP server; and A30, analyzing the online behavior CSV file and the network quality CSV file, and obtaining the user online behavior and the network quality result. According to the method, the user online behavior is analyzed on the home gateway, so that corresponding business information can be effectively acquired, the network is adjusted correspondingly according to the network quality monitoring result, differentiation service is provided, and the best service quality is provided for users.