Enlarged lymph glands are usually caused by infection, or cancer. There are other less common causes including haemorrhage, infarction and mineral accumulation. Enlargement of a single lymph gland, or a pair of lymph glands generally indicates there is a problem in the tissue that the glands are draining. For example, gingeval disease will cause enlargement of the submandibular lymph nodes. Enlargement of multiple lymph nodes is more likely to be caused by a systemic, or whole body problem, like lymphoma. I would most definitely recommend against massaging a swollen lymph gland. This may be painful and damaging. Your dog should be examined by a veterinarian. Depending on the history of the problem and the findings on physical examination, it may be necessary to do further testing to investigate the cause of the enlargment.
This is a great discomfort for your dog. This may be due to worms or other parasite. Best to have checked with vet. Also, they say if these are not the cause, I know this sounds ick, but manual manipulation to help with circulation may be needed. This will reduce swelling and discomfort