you can counter genjutsu by calming your chakra and disrupting your chakra, someone else can invade your body with their chakra and break the enemy's hold, and lastly, more traditional and for RP uses you can inflict a good amount of pain on yourself which will normally break the illusion.
Yep, that's basically it.
If you're under a genjutsu, it means your chakra has been corrupted by your opponent, so you need to disrupt your chakra flow. By doing so, the genjutsu will be over, and you will be snapped back to reality. There are two basic ways of disrupting your chakra flow:
Using Chakra to make it disrupt, which can be done by Kai, which basically forces chakra through your head and then blast outward, to force you out of the genjutsu, or with the help of an ally, which can insert his own chakra onto you and forcefully disrupt your chakra and get you out of the genjutsu.
Using Pain. A sudden and intense pain will force you out of the genjutsu because it will numb or even nullify your senses temporarily. Pain will overpower anything you're feeling, and thus it will snap you out of the genjutsu. This can be done my breaking a bone, piercing a kunai on your flesh, biting the inside of your mouth, etc (You have to be careful not to injure yourself to an extend that you can't fight anymore). Or, of course, having someone else causing you pain, but if you have an ally, it would be better to have him insert chakra in you, instead of injuring you.
Overall, having someone else, an ally, insert chakra onto you will release you out of any genjutsu, apart from Tsukyomi (Because the full effects of the Genjutsu happen in an instance, so there's literally no time for an ally to insert chakra in you). But some jutsu can't be broken by Kai (higher than B), or by pain (Genjutsu that provoke pain themselves can't be broken through pain). There are many other ways of breaking out of a genjutsu, though they aren't open for every ninja, for they need especial abilities. As you fight and gain more experience, you may even find alternative methods that are more suited for your characters.
Overall, Doujutsu users are immune to most genjutsus. Chakra sensors, although not immune, can distinguish what's real and what's not real, and can counter many genjutsu this way. Gathering Natural Energy will snap you out of many if not all genjutsus. Having a Bijuu means, in some cases, a constant ally. You can open the gates, the curse mark, etc and release yourself from the genjutsu through those bursts of chakra. You can even use stronger genjutsus to reverse the effects of weaker genjutsus, such as Itachi reversing Kurenai's genjutsus.
Yesh?