Here is a fretboard diagram of all the notes on the guitar. Play the notes on each string from the open notes to the 12th fret. The note on the 12th fret is one octave higher than the open note e.g. the open 6th string is an E note and the note on the 12th fret of the 6th string is also an E note, but is one octave higher.
Once you are confident you know the names of the notes along a particular string, pick the name of any note at random and find it on that string as quickly as possible. When this becomes easy, move on to the next string.
Another useful exercise is to find the same note on every string, remembering that a note usually appears twice on each string unless it is at the 11th fret.
Finally, name and play the notes across each fret. Once again use sharps as you go higher in pitch and flats as you go back down.