
当PLC只需要和同一个IP子网中的设备进行通信的时候,可以不用设置网关地址。

当PLC不仅和同一个IP子网中的设备通信,还需要与其它IP子网的设备通信的时候,就必须设置网关地址。

PLC所需要设置的网关地址就是它所在IP子网的路由器接口IP地址或所在VLAN的VLAN接口IP地址。

当PLC与同一个子网的设备通信时,数据会通过交换机直接发给目标IP地址的设备。
当PLC与不同子网的设备通信时,数据不会通过交换机直接发给目标IP地址设备,而是先发送给PLC设置的网关IP地址对应的设备即路由器,再由路由器查找路由后转发给目标设备。
作者:冯学卫