Using nanochannels, passivated with a lipid bilayer to avoid sticking of proteins, we study Rad51 filaments bound to single- and double stranded DNA. We demonstrate how we can discern different properties of the filaments by studying them at different degrees of confinement. Unlike the bacterial homologue RecA, that forms homogeneous filaments along DNA, Rad51 forms heterogeneous filaments containing both rigid kinks as well as flexible regions. Varying the counterion, the DNA substrate as well as the initial protein concentration, we try to understand the factors governing the structure of the filaments.