Oceania is always at war. The government preaches that "War is Peace" because when the nation of Oceania is at war, the people of Oceania are all linked together through strong nationalism. If they are at war with someone else, they will be at peace with each other. It is a disturbing and confusing idea, but if you look at the United States during World War II, you'll find a similar state of nationalism (a good term here would be jingoism - look it up!).
However, what matters less to the government is who they are at war with, as long as they are indeed at war in some capacity. At the beginning of the book, Oceania is, and has always been, at war with Eurasia, and Eastasia is an ally. However, in Book 2, the government announces that Oceania is, and always has been, at war with Eastasia, and that Eurasia is an ally.
In short: Oceania has always been at war, and they don't care who they are fighting. At the beginning, it's Eurasia, then it changes the Eastasia, and the government claims there has been no change.
In 1984, the world is divided into three states: Oceania, Eastasia, and Eurasia. Oceania is constantly at war with one of these states while at peace with the other. For the majority of the book, Oceania is at war with Eastasia and is allied with Eurasia. Winston, however, clearly remembers a time when Eurasia was the enemy, but the party have rewritten the official history and nobody is prepared to contradict this (Part 1, Chapter 3). So the party continues to vilify Eastasia by encouraging public hatred of the country and by executing its war criminals.
Suddenly, in the middle of Hate Week, an event designed to encourage hatred of Eastasia, Oceania switches its enemy. This happens without any warning and, all of a sudden, Oceania is at war with Eurasia and the war with Eastasia never existed. This happens in Part 2, Chapter 9, and brings the realisation to Winston that the entire history of the last five years will need to be rewritten.
But, as Julia notes in Part 1, Chapter 5, the enemy is not really significant: "It's always one bloody war after another, and one knows the news is all lies anyway." In other words, it's not the enemy who matters but rather the fact that Oceania is constantly at war. Whether the war is even happening is another non-issue: again, it is the fact that the party maintains a constant state of war that is truly significant. As Goldstein comments in his book in Part 2, Chapter 9, by keeping the people in this constant state, the party is able to perpetuate an unequal distribution of wealth. It is this unequal distribution which keeps the citizens of Oceania controlled and conquered.
There is a perputual war between the 3 superstates to drain resources so the people of the countries dont't have energy to think about rebellion. There are always 2 allied nations and 1 other nation fighting for the disputed lands as detaied in O'Brian's book.
Oceania was at war with Eurasia. Oceania was always at war with the two other totalitarian states of Eurasia and Eastasia.