Mark Langford, aged 55, was investigated after the National Crime Agency received a report of a user having child abuse material.
The agency then found he had groomed and sexually assaulted a teenage pupil almost 20 years ago.
Langford will be sentenced at Ipswich Crown Court on 25 September.
The teacher, formerly of Beccles, Suffolk, had written a letter to his victim last year in which he told them what to say to investigators, the NCA said.
Langford wrote: "Before you talk to him, please remember that it is his job to convict me - please do not give him any accidental ammunition against me."
The letter added: "You can tell him you know I'm a porn addict, and that I was arrested for having indecent images of children. Don't forget the 'arrested for' bit - don't say I did it, or that I confessed to you, because that might drag you into court as a witness."
Before his arrest, Langford, now of Ingleton, North Yorkshire, told officers: "It's all in there, I know what you're looking for, I've made a mistake and ruined everything".
Officers found 2,178 indecent images of children on five electronic devices, a further 199 prohibited images - and 109 extreme images.