In the campaign I'm currently playing in, the DM is having us make anti-characters for us to fight. I'm a walking stereotype (ELf Ranger) and so the DM said my anti has to be a dwarf. What class should he be? and should he be a dwarf or a duregar?
There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.
If you want to find the opposite of your current character, you should take each aspect of your character and turn it on its head. Here are a few things you could consider(but there are many more):
Are you from a city and wear metal armour and polished shoes? Your anti-character should wear leathers and pelts.
Are you from the Feywild, maybe your opposite comes from the Shadowfell.
Role In Combat
This is a great opportunity for you to really think about what your character is all about. Maybe not everything about your anti-character is a bad quality. Maybe the presence of some quality of his highlights your own lack of it (such as maybe he would risk his like for his companions if you are more selfish).
According to Tolkien (arguably one of the most significant influences on D&D and fantasy RPGs in general), elves are the opposite of orcs - the latter were created from corrupted elven stock, IIRC. The antagonism between elves and dwarves is another genre staple, but has always seemed to be characterized more as a love-hate relationship, since the two races differ in personalities, cultures etc., but are ultimately both 'good guys'.
Depending on what setting you're playing in, an orc or half-orc character might be more suited as the antithesis to your Elf Ranger.
Zibbobz' suggestion about the Necromancer sounds excellent. Assuming your Ranger is, as you say, a walking stereotype (i.e. tree-hugging animal-lover with dual-wielded weapons and all that jazz), then a good anti-character to act as a foil to your Elf could be a (Half-)Orc Necromancer; a bookish recluse who has no reverence or respect for nature - or indeed, any living creatures - and would much rather hang out at a nice graveyard, thank you very much.
(Corollary: if you're high level enough that you'd have to shop for magic items for your anti-character, you may want to look into something similar to the Hand of the Mage, from previous editions of D&D. Even though it's only power is to cast the 0th-level spell Mage Hand at will, it's described as a 'mummified elf hand' - definitely the kind of bling that an anti-Elf Necromancer would cherish.)
Or if you're feeling particularly daring, Necromancer Dwarf.
OR if you have source for it, a Drow would be an even more stark contrast.
Ooooor you could do what I did when my Barbarian Elf ran into a Mirror of Opposition, and have it be a completely non-standard Elf. A beer-chugging, loudmouthed, crass as all hell Barbarian with no regard for the sanctity of nature.
Ooooooor you could be even MORE daring and make it another Elven Ranger, but rather than a good-aligned one, make him stand for everything your character doesn't, using the same tools and tricks you use, but for the opposite ends.
In the end though, what truly opposes your character strongly depends upon your character. All of these suggestions are starting points. The end point should be a greater reflection on the character as you've played them, rather than the character steriotype.
Choosing a Duergar would be a nice variant for this request, but you should check with your DM if he will allow the race in play.
As for the class, you have a couple of choices: