Hello Roberto,
Good catch in the static routing portion of the Network Basics post. While Alexander is on vacation, I’ll try to answer the question.
I have a question about static routes, in particular as regards the static route inside the PLC. You say that in the PLC route table the entry 192.168.200.0 — 255.255.255.0 — 192.168.200.200 must be added, in this route table the route 192.168.10.0 – 255.255.255.0 – 192.168.10.10 is needed too?
The short answer is ‘no,’ because the PLC doesn’t need a static route to know to forward a packet to a known local interface. By the same token, the PLC doesn’t need the 192.168.200.0 — 255.255.255.0 — 192.168.200.200 entry because the PLC’s routing table already does it. If you look at a routing table within Windows (Command Prompt: route print), you will see that there already exists routing tables for forwarding a local network packet to the appropriate interface. The same exists in B&R PLCs.
Let me try to break down what is happening in the example:
Static route inside the notebook (in first network, 192.168.10.123)
192.168.200.0 — 255.255.255.0 — 192.168.10.10
The static route inside the notebook tells the notebook to send all packets destined for the 192.168.200.0 network to the PLC at 192.168.10.10. The packet looks as follows:
Source: 192.168.10.123 (notebook)
Destination: 192.168.200.10 (device)
Send to: 192.168.10.10 (PLC)
Since the notebook has a plan to reach 192.168.10.10 through the 192.168.10.123 interface, this packet will be sent to the PLC directly.
The PLC receives the packet and realizes that the packet is not for its address (despite being the recipient). The PLC then passes the packet through its routing table. Since the PLC has an interface in the 192.168.200.0 network, then it has a plan to send the packet along its way. The packet is sent out of the 192.168.200.200 interface to the device at 192.168.200.10.
Static route inside the machines network device (in second network, 192.168.200.10)
192.168.10.0 — 255.255.255.0 — 192.168.200.200
With the static route on the device, the return packet swaps the source and destination:
Source: 192.168.200.10 (device)
Destination: 192.168.10.123 (notebook)
Send to: 192.168.200.200 (PLC)
The PLC receives the packet from the device and notes that it is not the destination address. It puts the packet through its routing table and determines that it can send the packet out on the 192.168.10.0/24 network to reach the destination.
In short, you don’t need a static route if you have an interface on that network. Since the PLC has an interface in both networks, it doesn’t need a static route. Static routes are very useful for separating out the ‘send to’ and ‘destination’ fields so you can route between networks.