Section 21. Wherever there is no satisfactory through route for the transportation of passengers or freight at a reasonable rate, the department may order, after notice and a public hearing had upon complaint, any two or more railroad or railway companies whose lines, owned, operated, leased, or controlled by stock ownership, or otherwise, form a continuous or connecting line of transportation, or could be made to do so by the construction and maintenance of switch connection or interchange track at connecting points, or by transfer of property or passengers at connecting points, to establish through routes and joint rates, fares and charges for the transportation of passengers and property, and for the operation of the cars and other equipment for such transportation, within the commonwealth, as the department may by order designate; and, if the board of aldermen or selectmen act adversely upon, or fail to act within sixty days from the date of, the filing of a petition, brought by a railway company under section seventy of chapter one hundred and sixty-one for a location of tracks in their city or town upon which the petitioning company may construct the switch connection or interchange track necessary to the establishment of such through routes or transportation, or to the operation of such cars or other equipment, the petitioner or any interested party may, within sixty days thereafter, file such petition with the department which may, if after notice and a public hearing it is of the opinion that public convenience and necessity so require, grant locations upon which the grantee company may construct the switch connection or interchange track necessary to the establishment of such through routes or transportation, or to the operation of such cars or other equipment; and, if such railroad or railway companies cannot agree as to the division of rates or the conditions under which such through routes or transportation shall be established or such cars or other equipment operated, the department may, after due hearing, determine and prescribe the proportionate parts of such through rates payable to each of such companies, and the conditions under which through routes or transportation shall be established or such cars or other equipment operated; provided, that a railroad or railway company shall have control of and responsibility for the management and operation of all trains or cars while upon its railroad or railway as fully as if it owned them; and provided, further, that in case of a petition for the establishment of such through routes and transportation by railroad companies, or for locations for the construction of the switch connection or interchange track necessary to the establishment of such through routes and transportation by railway companies, the department shall give fourteen days' notice of any public hearing held by it under the foregoing provisions of this section, to the petitioners, to the companies affected and to the board of aldermen of the city or the selectmen of the town where the lines of said companies connect or within which a connection between the lines of said companies is proposed to be made. The foregoing provisions of this section shall apply to a railroad company and a steamship company whose lines forms or can be made to form a continuous or connecting line of transportation by transfer of property or passengers at connecting points, whether or not such railroad company and steamship company are commonly owned, operated, leased, or controlled by stock ownership, or otherwise. The department may, upon reasonable terms and conditions, require and order any railroad or railway company which carries freight in carload lots to establish and maintain for the purpose of receiving or delivering freight in carload lots, a switch connection with any private side track constructed on land adjoining the location of any such railroad or railway, if the department is of opinion that such connection is reasonable and practicable, can be put in and used with safety, and will furnish sufficient business to justify its construction and maintenance, and the department may grant to any railroad company the necessary locations in public ways and places for any switch connection ordered by the department to be constructed by such railway company.