A phosphonate-based metal–organic framework membrane was constructed on a porous anodic alumina membrane (PAAM) substrate for H2/CH4 separation for the first time.