The covalent organic framework (COF) shows great potential for use in gas separation because of its uniform and high-density sub-nanometer sized pores. However, most of the COF pore sizes are large, and there are mismatches with the gas pairs (3-6 Å), and the steric hindrance cannot work in gas selectivity. In this work, one type of COF (NUS-2) supported ionic liquid membrane (COF-SILM) was prepared for use in CO2/N2 separation. The separation performance was investigated using molecular dynamics simulation. There was an ultrahigh CO2 permeability up to 2.317 × 106 GPU, and a better CO2 selectivity was obtained when compared to that of N2. The physical mechanism of ultrahigh permeability and CO2 selectivity are discussed in detail. The ultrathin membrane, high-density pores and high transmembrane driving force are responsible for the ultrahigh permeability of CO2. The different adsorption capabilities of ionic liquid (IL) for CO2 and N2, as well as a gating effect, which allows CO2 passage and inhibits N2 passage, contribute to the better CO2 selectivity over N2. Moreover, the effects of the COF layer number and IL thickness on gas separation performance are also discussed. This work provides a molecular level understanding of the gas separation mechanism of COF-SILM, and the simulation results show one potential outstanding CO2 separation membrane for future applications.