Some networking commands

Posted by John Liu on Friday, November 5, 2021

Some basic networking commands for self reference:

List the current route table:

netstat -rn

Add an ip range into route table. –p means this route will persist so it will not be lost after restart.

route add 172.27.48.0 mask 255.255.240.0 172.27.48.1 -p

Access to any ip address starting with 172, inside the mask of 255.0.0.0, via ip address 192.168.0.10

Route add 172.0.0.0 mask 255.0.0.0 192.168.0.10 metric 4 –p

Remove from route table:

route add 172.27.48.0

Ping computer with IPv4 address

PING <computer name> -4

Ping computer with IPv6 address

PING <computer name> -6

To trace the route to an IP address

tracert 192.168.0.1