How do I know if my baby has an ear infection or is teething

She keeps pulling at her ear and touching the back of her head