Third, he gives the reason for this advice. For we should refrain from returning evil and should provide good things in the sight of all, in order that we might be at peace with men; therefore, he adds: have peace with all men. Follow peace with all men (Heb 12:14).
But he qualifies this when he says: if possible. For sometimes other people's malice prevents us from having peace with them, namely, because no peace is possible with them unless we consent to their malice. Such peace, of course, is illicit: I came not to send peace but the sword (Matt 10:34).
Another qualifier is added when he ...says: as much as is in you, i.e., even if they act against peace, we should do all in our power to preserve peace with them: I am for peace; but when I speak, they are for war (Ps 120:7). And elsewhere: seek after peace and pursue it (Ps 33:15).
Source: Commentary on Romans