Method for operating a data network of a rail vehicle, in which the data network has a network node, an electric device that is connected to a port of the network node and can be supplied with electrical energy via said port, as well as a data processing facility connected to the network node for controlling the network node, wherein a control command for switching the port on or off is transmitted from the data processing facility to the network node, according to a predefined, vehicle state-dependent switch on/off rule, and the port is switched on or off by the network node according to the transmitted control command, wherein the data network comprises multiple electric devices, which are connected to different ports of the network node, wherein the control command is a command for switching multiple of said ports on or off, and those ports of the network node, to which the control command relates, are switched on or off by the network node, wherein, on a change in state of the rail vehicle from a first vehicle state to a second vehicle state, those ports of the network node, to which the electric devices of a first device group are connected, are switched off, whereas those ports of the network node, to which the electric devices of a second device group are connected, remain switched on, and wherein, on a change in state of the rail vehicle from the second vehicle state to a third vehicle state, in addition to the ports that are already switched off of the network node, to which the electric devices of the first device group are connected, those ports of the network node, to which the electric devices of the second device group are connected, are also switched off, characterised in that, when the port is switched off as initiated by the data processing facility, a diagnostic system of the vehicle is influenced by the data processing facility in that the diagnostic system does not generate an error message that is based on the electric device being switched off or unreachable. wherein a control command for switching the port on or off is transmitted from the data processing facility to the network node, according to a predefined, vehicle state-dependent switch on/off rule, and the port is switched on or off by the network node according to the transmitted control command, wherein the data network comprises multiple electric devices, which are connected to different ports of the network node, wherein the control command is a command for switching multiple of said ports on or off, and those ports of the network node, to which the control command relates, are switched on or off by the network node, wherein, on a change in state of the rail vehicle from a first vehicle state to a second vehicle state, those ports of the network node, to which the electric devices of a first device group are connected, are switched off, whereas those ports of the network node, to which the electric devices of a second device group are connected, remain switched on, and wherein, on a change in state of the rail vehicle from the second vehicle state to a third vehicle state, in addition to the ports that are already switched off of the network node, to which the electric devices of the first device group are connected, those ports of the network node, to which the electric devices of the second device group are connected, are also switched off, characterised in that, when the port is switched off as initiated by the data processing facility, a diagnostic system of the vehicle is influenced by the data processing facility in that the diagnostic system does not generate an error message that is based on the electric device being switched off or unreachable.