As the basic component of smart grid, Smart Meter System (SMS) can regularly report the detailed electricity consumption data of users to power companies. However, SMS also bring some security problems, such as user privacy disclosure. This paper proposes a privacy protection scheme based on virtual ring for SMS based on fog computing. This scheme can provide the privacy of power consumption data and user identity, so that the attacker can not know the relationship between matching power data and user identity. In the proposed scheme, the SMS can use its virtual ring membership to anonymize its real identity, and it can also use asymmetric encryption and Paillier homomorphic system to generate ciphertext data from its power consumption data; Then the SMS sends the ciphertext data to the connected fog node, and the fog node collects regularly the ciphertext data of the SMS it manages. At the same time, the fog node verifies the virtual ring identity of these SMS, and then aggregates the collected ciphertext data and sends it to the control center; Finally, the control center decrypts the aggregated ciphertext to obtain the power consumption data. The experimental results show that the proposed scheme has some advantages in computing and communication costs.