There are two ways to look at such a question. On the one hand, some wars actually have to be fought to attain peace and in some other cases, war just invites more trouble. Unjust wars are those where dictators blow their way into power and hold the nation in an iron grip. There are several examples in history to quote from regarding this. During the World Wars, western nations literally blew each other apart.
They are currently distinct blocks of the United States, the European Union and the ASEAN countries. They are all attempting to maintain peace and prevent war of massive proportions from rising. The need for regulatory bodies such as the UNO is needed, but the fact remains that, with the various thought processes of the governments it is sometimes hard to pull back nations from being on the brink of constant war.
As far as war for peace goes, several nations across the world – and it still happens in fits and starts – needed to break away from the bondage of colonization and ended up waging a bloody war to get freedom. There has not been a bloodless war for freedom anywhere in the world until today. It has happened in China, Indian, South Africa and so many countries under able leaderships. Such war is what has made the world take notice of the nation in question and make it a force to reckon with worldwide.
You can’t really separate war from peace. Some circumstances necessarily advocate the medium of war in order to reach a peaceful future. However, there have been times when governments and unscrupulous agents have used war for peace as a covert means of achieving other things.