Use the training flag, and put them across the boundary in the early days of training. So, the dog can start recognizing his limits. Keep the flags for at least 2-3 weeks and then start removing them gradually. Till then, the dog will get familiar with his boundary and will start avoiding crossing the designated area.