Yes, a landlord is entitled to ask tenant's to pay rent upfront. There is no limit on the number of months rent a landlord can request from a tenant.
Landlords can also specify for which month the upfront rent is for. For example, you can be asked to pay two months' rent: one for the first month of your tenancy agreement and one for your last.