FlightPlane has some great instructions for connecting to flight sims using a number of different approaches. The easiest option I’ve found so far is to download the Flight Events app from https://events.flighttracker.tech/ . Press the Join button top right and follow the instructions.
Enable the ‘Broadcast data to local network’ option. Initially ForeFlight didn’t show the Flight Events panel under ‘More… Devices’ until I entered the current ip address of my iPad on my network in Flight Events (instead of the default broadcast option) :
and the Flight Events appeared in the Devices panel here:
Click ‘Flight Events’, enable, and then ForeFlight is sync’d with your sim.