The father is desperately trying to impart two main teachings and beliefs to the boy, and balance the seeming contradiction between them. The first thing that the father wants the boy to learn is that they live in a dangerous world where others can't be trusted. Any time they come across a survivor in their journeys, the boy's instinct is to stop, help, and give whatever resources they have to help that person survive. The father fights this instinct in the boy, and tries to teach him that they need all of the resources themselves, and that they can't afford to share, or they'll die. He also tries to teach the boy proper caution in speaking to these survivors, as they could be traps set for the more barbarous cannibals that roam the lands. He also needs the boy to understand how dangerous those cannibals are, and how he needs to be vicious and vigilant in protecting himself against these marauders.
The second belief and notion that the father wants the boy to learn is in seeming contradiction with the first. It is that people are good, at their cores, and that staying good, no matter what, is worth surviving for. He speaks of "the fire" that they carry with them--this light is decency, humanity, kindness and goodness. In a world that is seemingly devoid of these traits, the father doesn't want them to die out. He doesn't want the awful world they're living in to stifle those traits in the boy's heart, because they are the only thing that makes living on this planet bearable. That belief, that people are good, and that we should be kind, contradicts the more harsh survival techniques that the boy must learn, that teach you must be cruel to survive.
The father imparts these beliefs through his words, and also through his actions. He uses his gun to protect them from the barbarians. He speaks constantly of "carrying the fire", and how it is important to keep it lit. He gives lessons and lectures to the kid on survival, and tries to sympathize with the kid's urge to help everyone that they run across. Example, teaching moments, and stories all help the father to teach his son how to survive, both physically, and with his humanity in tact. I hope that helps; good luck!