How to add a static IP route?


1.  Introduction

Guides to add a route to communicate with a drive through another device.

 

 

2.  How to add a static IP route to communicate with a drive through another device.

Example: The PC is connected to the Beckhoff PLC and the drives are connected to the Beckhoff PLC as shown in the below image.




Assumptions:

IP settings of drives:

Drive 1:

IP address: 192.168.1.1

Subnetmask: 255.255.255.0

Drive 2:

IP address: 192.168.1.2

Subnetmask: 255.255.255.0

Drive 3:

IP address: 192.168.1.3

Subnetmask: 255.255.255.0

 

IP settings of the device (in this case Beckhoff PLC): IP address: 192.168.0.12

Step 1:

 

Ping to the device and make sure that it is able to communicate with PC.


 

 

Step 2:

 

Run command prompt with admin rights

 

Step 3:

 

Add route as described below:




Since IP address of the drives are 192.168.1.1, 192.168.1.2 and 192.168.1.3, So add route to 192.168.1.0 so that it will be possible to communicate to all three drive.

Format of the command:

route add destination mask subnetmask gateway metric costmetric if interface

 

Field

Compulsory/Optional

Description

destination

Compulsory

Specifies either an IP address or host name for the network or host.

subnetmask

Compulsory

Specifies a subnet mask to be associated with this route entry. If subnetmask is not specified, 255.255.255.255 is used.

gateway

Compulsory

Specifies either an IP address or host name for the gateway or router to use when forwarding.

costmetric

Optional

Assigns an integer cost metric (ranging from 1 through 9,999) to be used in calculating the fastest, most reliable, and/or least expensive routes. If costmetric is not specified, 1 is used.

interface

Optional

Specifies the interface to be used for the route that uses the interface number. If an interface is not specified, the interface to be used for the route is determined from the gateway IP address.

 

Note: In the above method, the added route is valid until rebooting the PC. So to make sure the route persistent, the below method needs to be followed:

 

文本框:

Execute the route add command with –p as shown in the below image


Step 4:

 



Check whether now the drives are able to communicate or not:

 


 


 


3.  How to delete added Route

Step 1:

 

Run command prompt as administrator.

 

Step 2:

 

Execute route delete command in command prompt. Format of the delete command:




route delete destination