Intrinsic Josephson effect in layered superconductors with d-wave pairing