War machine crews are not especially known for their valour, and will normally defend their machine from behind, beneath (or within) its frame. This is a valid defensive tactic, as there is a limit as to how many enemy warriors can physically crowd around a war machine.
At the start of the Close Combat phase, before any blows are struck, the player whose unit(s) are attacking the war machine must choose six models who will fight in the combat (the assault party, if you will) – the rest cannot get close enough to land blows.
Only six models can be chosen per war machine being fought, regardless of the number of units that are fighting. Obviously, some models are bigger than others, so monstrous infantry/cavalry/beasts each count as three models when selected to fight a war machine, while a monster (including any rider) counts as five models.
All models chosen for the fight are considered to be in base contact with the war machine. Models that are in base contact with other enemies cannot be chosen to be part of a war machine's assault party – they're too busy fighting their more immediate foes.
The combat is otherwise resolved normally. In particular, casualties are taken from the 'back' of the unit as normal – models step up and join the fight in place of fallen comrades, assuming there are enough survivors to do so. When it comes time to fight, the war machine makes a number of attacks equal to the number of surviving crew models, using their Weapon Skill, Strength and Initiative. Enemy models strike at the war machine normally, resolving their attacks against the crew's Weapon Skill and Toughness. The crew can then take any saves to which they are entitled.
A war machine does not have any flanks or a rear for the purposes of combat results. If a war machine manages to win its combat, it is not allowed to pursue and restrains pursuit automatically. The crew always hold their ground and continue the business of operating the machine. If the war machine loses the combat and fails its Break test it is destroyed.