A buffer is a solution that resists any change in its pH on adding small quantity of a base and acid to it.
The component required for a solution to be a buffer is that acid or base and its salt .
That is for a acidic buffer, component required will be acid and that acid salt with a strong or weak base.
For example: A solution of acetic acid and sodium acetate.
For a basic buffer: Component required will be base and that base salt with a strong or weak acid.
For example: A solution of ammonium hydroxide and ammonium chloride.