It's a pain in the ass in gen 4. Use an unsecured router / access point. Your phone may work as one depending on your carrier.
Go to your game's connection settings, connect to your unsecure access point, set DNS to 164.132.44.106. and you should be good.
Leave the second DNS field blank.
Here's an article with more in-depth steps:
https://www.shacknews.com/article/108512/how-to-unlock-gen-4-and-5-pokemon-mystery-events-in-2018