An analysis of the dynamic response of an underground main pipeline under a longitudinal wave propagating in soil along the pipe is given in the article. The problem of the longitudinal wave impact on a pipeline of finite length, interacting with soil according to the elastic-viscous law, is considered. The ends of the pipeline are fixed to massive nodes that interact with the medium according to linear laws. Along the length of the pipeline, the coefficients of the elastic and viscous pipeline-soil interaction change depending on the coordinate. In this article, the influence of the coefficients of elastic and viscous interaction of the "pipe-soil" system is studied when these coefficients are coordinate functions. The variability of the values of the coefficients along the length of the pipeline leads to a change in displacements from 0 to 15% and strain from 0 to 18%, compared with the case when these coefficients are constant. Depending on the length of the pipeline, the response of the pipeline to seismic action is different. This is especially evident at the boundary points. Considering the weight of nodes leads largely to a decrease in the strain of the pipeline relative to the soil strain at the boundary points.