Children fighting


My sons are 7 and 9. They’re really close, but fight sometimes. Yesterday, my younger son started annoying his brother, and my eldest beat him on the forehead with a book.

It drives me crazy because this situation happens again and again, the little one wants attention from us, or his brother, or is tired, and starts annoying the eldest, who responds violently.
We have explained to them many times that it was not possible.

I am not into punishment, I don’t really see what kind of consequence would work. Speaking to them hasn’t work either. How could I find a way to put limits to them ?