Hi, and welcome to this forum.
Make sure that your 2i4 is selected as MIDI input (when SONAR is open) in Preferences (P) MIDI.
And that you select the 2i4 as MIDI input on your MIDI track / Instrument track.
MIDI itself does not make sound, so you will have to assign a Vsti / soft synth to play back your MIDI.
This video might be of help, unless you think it is too long / tedious.
It goes through setting up, and using soft synths in X1.
All the best.