A thoroughly ordinary middle-class house in St. Petersburg, Russia, 1883-1884
It's a little bit tricky to establish the setting for Ivan Ilych, because the narrator is so fond of playing around with space and time. Different parts of the story take place on very different scales. (See "Symbols, Imagery, Allegory" for why this may be.)
Chapters 2 and 3 have no "micro" (small-scale) setting, but only a "macro" (large-scale) setting. They cover forty-five whole years during which Ivan moves around a lot from one non-descript place in the Russian provinces to another. He eventually winds up in St. Petersburg (the only place that even receives a name). It's hard to give any more specific setting than "Nineteenth Century Russia" for those first chapters – though if you really wanted to be picky you could say "1839-1884," since those are the years of Ivan's life.
On the other hand, the larger chunk of the narrative is spent in the (then) Russian capital of St. Petersburg, particularly in Ivan Ilych's house there. All of the last parts of the story take place at his home, since Ivan is homebound. That part of the narrative also covers a much narrower time span, that of 1883 and 1884 (the year Ivan dies). The middle chapters span months and the last chapters span weeks and then finally days.
The multiple layers of setting work together. By making Ivan's whole life – with its forty-five year span and its many places of residence – the story's subject, Tolstoy can contain a whole world within one story. That would be the world of Modern Russian Society (as Tolstoy knew it), which was took shape largely during the span of Ivan Ilych's life. In many respects, the direction Russia was going really rubbed Tolstoy the wrong way, and in Ivan Ilych one of his primary goals is to tear his contemporary world to shreds through satire.
The smaller-scale setting – Ivan's home in St. Petersburg – Tolstoy uses to represent that world more concretely, just as he uses the characters to represent the kind of detestable "modern" people who live in it. It's logical that Ivan lives in Petersburg, because it was the political and cultural capital of Russia and its most "modern" city. It was the place where the changes Tolstoy detested were at their most developed.
What were the parts of "Modern Russian" society which Tolstoy had in his sights? One was the growing "official" class of lawyers and government bureaucrats (that would be Ivan and all of his friends) who were centered in Petersburg but spreading throughout the country. Tolstoy sees them as driven only by petty ambition and greed; they're false, selfish, and ultimately fairly useless to society.
Another target is the medical profession, also centered in Petersburg but spreading. In Petersburg in particular a kind of cult formed around "celebrity doctors," well represented in the novella by Praskovya Fedorovna and the doctors she brings in. Tolstoy didn't think that modern doctors treated their patients like human beings, and was disturbed by the way in which medicine seemed to be replacing religion as the main way people had of dealing with death. According to Tolstoy, modern medicine actually reflected an inability to accept death.
Finally, just who are these modern "people" that we're talking so much about? The growing Russian middle class, particularly numerous in Petersburg and other cities. Essentially, everyone in Ivan Ilych (except the servants) belongs to this new class. They are characterized, in Tolstoy's picture, by several things: an exaggerated concern with social climbing and impressing each other; a great degree of sameness, which comes from trying to do what everyone else is doing; a greed for consumer goods; an individual selfishness which makes genuine family life and friendship impossible; and an obsession with fake manners (propriety) which substitute for genuine morality. It's their lifestyle, which Tolstoy is targeting as false. They're also the ones hiring out all the doctors, because (Tolstoy thinks) they can't deal with death.
The smaller setting of Ivan's house embodies that world which Tolstoy hates so much. He even describes particular pieces of furniture (the springy pouffe that Peter Ivanovich sits on, for instance) to create a picture of a typical home that would be instantly recognizable to contemporary readers. Ivan's home is the perfect middle-class apartment. As the narrator says, it "was so like the others that it would never have been noticed," though to Ivan "it seemed to be quite exceptional" (3.17). All of the exaggerated care that Ivan and Praskovya Fedorovna put into decorating the house and filling it with carefully selected furniture reflects their crass materialism, and their desire to one-up their middle-class friends. The irony is that because they're so concerned with impressing other people, they're totally unoriginal; their house is the same as ever other house. Even more ironic, Ivan's death is ultimately induced by the drapery.
Ivan's house, it turns out, comes to be the prison which he cannot leave as his sickness renders him homebound. All of the comfort and excitement it once gave him disappear. The house is a metaphor for the whole of Ivan's middle-class life: for its isolating smallness, its artificiality, its concern only with appearance, its horrible ordinariness, and its inability to provide real happiness.