Changing routing table entries on windows operating system

To change the routing table entries on windows operating system we need to use “route” command. In windows operating system, “route” is a command-line utility used to view and manipulate the TCP/IP routing tables. Manual manipulation of the routing table is characteristic of static routing i.e., if we are manipulating routing tables using “route” command then we are doing static routing not dynamic routing.
To see details about “route” command simply type “route” on cmd as shown below:
C:\Users\Dell>route
This will display following information:

ROUTE [-f] [-p] [-4|-6] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]
-f     Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands,        the tables are cleared prior to running the command.
-p     When used with the ADD command, makes a route persistent across boots of the system. By default, routes are       not preserved when the system is restarted. Ignored for all other commands, which always affect the appropr       iate persistent routes. This option is not supported in Windows 95.
-4     Force using IPv4.
-6     Force using IPv6.command One of these: PRINT     Prints a route ADD       Adds a route DELETE    Deletes a route CHANGE    Modifies an existing route destination Specifies the host. MASK      Specifies that the next parameter is the 'netmask' value. netmask   Specifies a subnet mask value for this route entry. If not specified, it defaults to 255.255.255.255 g            ateway Specifies gateway. interface the interface number for the specified route. METRIC    specifies the metric, ie. cost for the destination.

Now to simply print the routing table information type “route PRINT” as shown below:

C:\Users\Dell>route PRINT

This will output the information similar to as shown below, this information contains Network Interface List and
Routing Table mapings for both IPv4 and IPv6 based IPs.

===========================================================================Interface List 31...f8 2f a8 c8 65 6b ......Microsoft Virtual WiFi Miniport Adapter 14...f8 2f a8 c8 65 6c ......Bluetooth Device (Personal Area Network) 12...f8 2f a8 c8 65 6b ......Dell Wireless 1704 802.11b/g/n (2.4GHz) 11...74 86 7a 4e df 31 ......Realtek PCIe FE Family Controller 1...........................Software Loopback Interface 1 18...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #3 26...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #8 21...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #6 17...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #2 19...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #4 15...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter 22...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface 25...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #7 27...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #9 33...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #12 30...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #10 32...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #11 42...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3 35...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #14 34...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #13 38...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4 41...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #5 55...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #6 37...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter #16===========================================================================IPv4 Route Table===========================================================================Active Routes:Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.43.1 192.168.43.193 25 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 192.168.43.0 255.255.255.0 On-link 192.168.43.193 281 192.168.43.193 255.255.255.255 On-link 192.168.43.193 281 192.168.43.255 255.255.255.255 On-link 192.168.43.193 281 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 192.168.43.193 281 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 192.168.43.193 281===========================================================================Persistent Routes: NoneIPv6 Route Table===========================================================================Active Routes: If Metric Network Destination Gateway 22 58 ::/0 On-link 1 306 ::1/128 On-link 22 58 2001::/32 On-link 22 306 2001:0:9d38:90d7:3061:11f1:3f57:d43e/128 On-link 12 281 fe80::/64 On-link 22 306 fe80::/64 On-link 22 306 fe80::3061:11f1:3f57:d43e/128 On-link 12 281 fe80::e99c:ff92:bb99:b49d/128 On-link 1 306 ff00::/8 On-link 22 306 ff00::/8 On-link 12 281 ff00::/8 On-link===========================================================================Persistent Routes: None

This information can be manipulated by using following various options of “route” command as shown below:

 > route PRINT > route PRINT -4 > route PRINT -6 > route PRINT 157* .... Only prints those matching 157* > route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2 destination^ ^mask ^gateway metric^ ^ Interface^ If IF is not given, it tries to find the best interface for a given gateway. > route ADD 3ffe::/32 3ffe::1 > route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2 CHANGE is used to modify gateway and/or metric only. > route DELETE 157.0.0.0 > route DELETE 3ffe::/32

Comments

Popular posts from this blog

MATLAB code for Circular Convolution using Matrix method

Positive number pipe in angular 2+