Estimating line impedance is relevant in transmission and distribution networks, in particular for planning and control. The large number of deployed PMUs has fostered the use of passive indirect methods based on network model identification. Electrified railways are a particular example of a distribution network, with moving highly dynamic loads, that would benefit from line impedance information for energy efficiency and optimization purposes, but for which many of the methods used in industrial applications cannot be directly applied. The estimate is carried out onboard using a passive method in a single-point perspective, suitable for implementation with energy metering onboard equipment. A comparison of two methods is carried out based on the non-linear least mean squares (LMS) optimization of an over-determined system of equations and on the auto- and cross-spectra of the pantograph voltage and current. The methods are checked preliminarily with a simulated synthetic network, showing good accuracy, within 5%. They are then applied to measured data over a 20 min run over the Swiss 16.7 Hz railway network. Both methods are suitable to track network impedance in real time during the train journey; but with suitable checks on the significance of the pantograph current and on the values of the coefficient of determination, the LMS method seems more reliable with predictable behavior.