Although the best thing to do is to go and see a doctor there are a few factors which you could work on to determine what causes your symptoms.
It might be that some kinds of food make you feel worse, for example spiced foods, foods with lots of fats, processed red meat, foods too rich in fiber like legums or vegetables and diary products are more likely to irritate your bowel. Similarly, drinking fizzy drinks, alcohol, coffee or tea can also cause irritation. So keeping an eye on what food you consume could help improve your lifestyle.
Another thing which can cause IBS is stress along with anxiety, which can both lead to an increased mobility of the colon (the place of the bowel where thousands of bacteria like e. coli process your food). This will then cause abdominal pain, especially if gas is formed inside your bowel. There are some kind of tablets sold in pharmacies which target IBS symptoms and reduce pain due to gases. Taking on a sport activity might be helpful as it often reduces stress.
Mind that, unless you have been diagnosed with IBS, your symptoms could also describe a food intolerance.
As of today, there is no agreement among the scientific community on the causes of IBS, and there is no known "cure". Moreover, there is a lot of information on the Internet regarding which foods one should eat to ease symptoms but you might find that even following a diet might not help you, especially if your condition is determined by psychological factos such as stress. Engaging in relaxing activities and taking bacteria supplements usually helps. You might need to find out on your own which foods are good and which ones are not, so keeping a diary of what you eat might be useful.
Also, if you symptoms are affecting your life so much it would be a good idea to go talk to a doctor to ask if they can give you any tablets to reduce the inflamation.
As for the rectum pain, it might be because the irritation has spread from your colon to the rectus or because of friction, either way you should see a doctor who then could prescribe you some lotion to apply there.
Sources: http://www.nhs.uk/Conditions/Irritable-bowel-syndrome/Pages/Causes.aspx
http://www.mayoclinic.org/diseases-conditions/irritable-bowel-syndrome/basics/treatment/con-20024578
I have had IBS for two years now and seen more than one doctor about it.