Erbium-doped fiber amplifier (EDFA) is the most commonly used optical amplifier in today's optical network, its gain competition brings dangers to optical network. This paper firstly introduces the principle and gain competition of EDFA, then establishes experiment platform to realize the EDFA gain competition attack, finally analyzes the effects of attack signal power and frequency on the legitimate user signal gain. The experimental results show that the attack signal can result in gain competition attack when its power is more than 20dB higher than the legitimate user signal power, and when the attack signal power is higher, the gain competition attack is more obvious; when the attack signal frequency is closer to the legitimate user signal frequency, the gain competition attack is more obvious.