Visas are not required by visitors from Armenia, Azerbaijan, Bolivia, China, Egypt, Georgia, Lebanon, Malaysia, Syria, Turkey and Venezuela.
Passport holders from Afghanistan, Bangladesh, Canada, Colombia, Iraq, Jordan, Libya, Nepal, Pakistan, Somalia, Sri Lanka, United Kingdom, United States and Yemen must obtain a visa in advance.
Everyone else can obtain an evisa or get a visa on arrival. It is strongly recommended to get an evisa as the visa on arrival system may be problematic.
If you are crossing overland you will need to arrange a visa in advance. Visas for Iran can take many weeks to get approved and it can be a very frustrating experience.
It may be quicker and easier to apply for a transit visa that is valid for ten days. The transit visa can be easily extended once you are in Iran.
If you look around on the internet you will find services that will arrange a visa for you. You can do this yourself simply by filling out a form and faxing or emailing an embassy.