Gel electrophoresis and capillary gel electrophoresis are widely used for the separation of biomolecules. With increasing demand in the miniaturized devices such as lab-on-a-chip, it is necessary to integrate such a separation component into a chip format. Here, we describe a simple approach to fabricate robust three-dimensional periodic porous nanostructures inside the microchannels for the separation of DNA molecules. In our approach, the colloidal crystals were first grown inside the microchannel using evaporation assisted self-assembly process. Then the void spaces among the colloidal crystals were filled with epoxy-based negative tone photoresist (SU-8). UV radiation was used to cure the photoresist at the desired area inside the microchannel. After subsequent development and nanoparticle removal, the well-ordered nanoporous structures inside the microchannel were obtained. Our results indicated that it was possible to construct periodic porous nanostructures inside the microchannels with cavity size around 300 nm and interconnecting pores around 30 nm. The mobility of large DNA molecules with different sizes was measured as a function of the applied electric field in the nanoporous materials. It was also demonstrated that 1 kilo-base pair (kbp) DNA ladders could be separated in such an integrated system within 10 min under moderate electric field.