Sign-in to your Google account and go to the 2-step verification page. You can use the direct link or reach it via your Google account settings.
Click on the large blue Setup button and the guide walks you through the steps needed to setup the authentication layer. Basically it involves giving Google your mobile number and choosing the mode of code delivery (text or voice).
You don’t want to enter a code again and again for checking your email, so setup Google to remember your trusted devices for at least 30 days.
In the final step, activate 2-step verification for your Google account. Now, if you sign-in from an unrecognized device or computer, you will be asked for the code.
Here’s how the verification code prompt looks when you try to log-in:
Google also prompts you to create some application specific passwords. It’s for those apps you use to access your Google accounts from mobile devices and third-party email clients likeMS Outlook.
You can also add a trusted secondary mobile number to receive the verification codes, in case you lose your main phone or keep it somewhere else. Google also gives you backup codes to access your email accounts on the go when you might not have cell coverage. Thesepermanent codes do not expire and you can use them during such emergencies
Thanks to Brainiac