Apart from being the inspiration for a pretty rockin' Tom Petty song, walls are a powerful symbol in The Red and the Black.
The narrator tells us in the very first chapter that:
In Franche-Comté, the more walls you put up, the more your property bristles with rocks heaped one on top of another, the more claim you have on your neighbors' respect. (1.1.7)
Walls symbolize private, exclusive property, and 19th-century French society pretty much runs on exclusivity. After all, how else are you going to determine which people are better than others?
One of the characters in this book who especially loves walls is Monsieur de Rênal, the mayor of Verrières. The narrator tells us that:
Monsieur de Rênal's gardens, packed with walls, are even more admired because he bought—for just about their weight in gold—the bits and pieces of land on which they lie. (1.1.7)
People respect dudes with a lot of property in this book. But what they respect even more are people who go out of their way to show everyone that they own a chunk of the world and that no one else is allowed to use it.
As you can imagine, there's another side to this symbol. It also means that people like Monsieur de Rênal often feel lonely. They're so busy closing themselves off from the world that they leave no room for any actual connection with others.