Since Ironhide's history is so complex, thanks to the comics confusing everything ever, he will be using the most coherent backstory possible, using an amalgamation of two movies, the comics Alliance, Defiance and Tales of the Fallen, along with the novel The Veiled Threat, as this timeline makes the most logical sense.
HISTORY:
It is said that Ironhide is one of the oldest known Autobots--and he looks it, with his body still carrying many scars, broken pieces, and countless repairs, most specifically a bad hip and faulty core timing (according to the bio on the back of his toy). He is a veteran of countless battles, both on Cybertron, and on Earth.
He was a captain in Megatron's protection force, the Cybertronian Armed forces, fighting to protect the planet and the All Spark from invasion, and well-known for his ability on the field. He worked closely with Starscream, and other warriors, who would later turn on their own kind. When Megatron fell into madness, ordering the deaths of a group of scientists--including Optimus Prime, Ironhide was among the first dissenters to join Optimus, refusing to take innocent lives. This was the most difficult choice he had to make. Did he stay with the army, as was his function, or did he follow his programming, and go with what he knew was right? There was no way that a group of scientists--one of whom did good repair work from time to time--could be guilty of what Megatron claimed. There was no reason for Megatron's claim... and calling for execution, their execution, was not the purpose of soldiers. They were built to protect civilian life, not take it.
He knows full well that he betrayed the armed forces just as much as the others did when he walked away. But he will never admit it. Especially after the war began, and his choice was vindicated. He does not regret what he did, and if pressed, he will justify his decision.
He has been serving under the Autobot leader ever since.
When the war officially broke out, he became indispensable, providing tactics, and some intel on the Decepticons. At some point during the war, he was given the task of training the young warriors, produced to bolster the Autobot forces. One in particular was called Sideswipe, and the two were, apparently, quite close. They lost contact after the disaster at Sideswipe's colony, and the young Autobot vanished.
Eventually, Optimus was forced to launch the All Spark from Cybertron, in an attempt to end the war, despite dooming their race. Megatron followed it, but the war continued. It was decided that a group of Autobots would seek out the All Spark, and Megatron, before the Decepticon forces could do the same. Ironhide was among that group.
Once on Earth, he joined in the search, resulting in a great deal of frustration, and the discovery of the boy Samuel Witwicky, who was in possession of a map to the All Spark. All this searching eventually culminated in the battle of Mission City, and the apparent death of Megatron when Sam shoved the All-Spark into Megatron's own spark, along with their longtime lieutenant, Jazz. Ironhide was among the cleanup crew following the battle, partnering with Captain Lennox's team in taking down the rogue machines created by the All-Spark's energies. He later aided in transporting the Decepticon remains to their final resting place, taking part in small skirmishes with them along the way.
He, along with the other surviving Autobots, joined forces with the human military, forming the group known as NEST, in order to hunt down both the remaining Decepticon forces, and any that might arrive later on. With Megatron dead, it seemed that Starscream had taken over the command of the Decepticons. For two years, they fought battle after battle, collecting more Autobot refugees, and coming out with more victories than they did losses. Every part of the globe was under scrutiny, from the African desert, to the Andes.
In Africa, they engaged Starscream's forces at a major dam in Zambia, defeating them, and saving millions of lives, as the Decepticons had been attempting to break the dam. Later, he took part in a mission to Australia, in which it was discovered that there were a splinter group of Decepticons, working toward Megatron's resurrection. This only strengthened the need to step up patrols, and stop any Decepticon entering Earth's atmosphere.
An incident took place in Buenos Aries, in which Ironhide was called on to reign in his old student. Sideswipe had reappeared, obsessed with revenge, and was hell-bent on taking down a massive Decepticon alone. The younger Autobot managed to rack up a large death toll, and huge amounts of property damage before Ironhide could talk him down. It took the old warrior throwing himself in front of a missile strike to get through to the younger, and haul him back to NEST.
All went as planned, until a routine mission in Shanghai came coupled with a strange warning about "the Fallen". From there, everything fell apart--the human government's relationship with the Autobots disintegrated into suspicion, Megatron was revived, and, worst of all, it seemed, Optimus was killed.
Following the apparent disbanding of the NEST forces, Ironhide took part in the battle in Egypt, fending off the oncoming Decepticon horde until Sam could reach Optimus--presumably with a way to restore Ironhide's leader and old friend back to life. During that battle, Sam was killed, seemingly ending all hope of reviving Prime, and Megatron's massed forces drew down on the dwindling NEST team.