# Viewing and Changing Your Computer's Routing Table ## :question: Purpose This tutorial is for understanding the basics of routing table and ping for testing. Here, we will try to disconnect our computer to the internet and reconnect it. ## :feet: Step 1. Open a command prompt window by typing cmd in the run box as shown in previous weeks and ensure you run as administrator by right clicking on "cmd" when it appears as a search result as shown in following image ![image](https://hackmd.io/_uploads/SktEweVeA.png) 2. To view your routing table, type route print | more and press Enter. The | more after the route print command causes output to be displayed one screen at a time You should see the following results for your route print | more command. ![image](https://hackmd.io/_uploads/HykvPxVg0.png) - Network Destination — The network destination your computer compares with the destination IP address of outgoing packets to determine where to send them. - Netmask — The subnet mask of the network destination. A value of 255.255.255.255 indicates that the address in the Network Destination column is a specific IP address rather than a network address; it's referred to as a "host route." A value of 0.0.0.0 is used when the network destination is 0.0.0.0, indicating the default route or gateway. - Gateway — The next hop address or the on-link, which means the network is connected directly to an interface. Make a note of the value in this the 0.0.0.0 network destination, as you need it later. - Interface — The address of the interface Windows uses to send the packet to the network destination. - Metric - The metric assigned to the route. If there are two entries for the network destination, the lower metric is the route chosen. 3. To verify that you can communicate with the Internet, type ping 8.8.8.8 press Enter. If the ping is successful, your default network is working correctly. You should see the following results for your ping command ![image](https://hackmd.io/_uploads/rJLK9x4gR.png) In case you are wondering about the ip address 8.8.8.8. Google Public DNS 4. Type route delete 0.0.0.0 and press Enter to delete your default route. Try to ping 8.8.8.8 again. The ping will fail. You have 'broken' your Internet Connection. Next, return to the Command Prompt and Type route print | more and press Enter. You will see that the 0.0.0.0 network destination is no longer in the table. Press the spacebar more times to display the rest of the output. 5. To create the default route entry and restore your routing table, type route add -p 0.0.0.0 mask 0.0.0.0 default gateway and press Enter (replacing default-gateway with the address you noted in Step 3). e.g. route add -p 0.0.0.0 mask 0.0.0.0 193.61.191.201 (as shown next). Note your default-gateway IP may differ - see step 3 above where you record it from the route print table command. ![image](https://hackmd.io/_uploads/HkJgigExC.png) 6. Display the routing table again to verify that your default route is ok ## :8ball: BONUS (Installing telnet) ### The reason that we want to install telnet rather than ordinary ping command is that we can also check the port if it is working or not 1. Enable the Telnet Client in Windows In Windows 11, Windows 10, Windows 8, Windows 7, and Windows Vista, turn on the Telnet Client in Windows Features in Control Panel before any relevant commands can be executed. Open Control Panel by searching for control panel in the Start menu. Or, open the Run dialog box via WIN+R and then enter control. 2. Select Programs. If you don't see that because you're viewing the Control Panel applet icons, choose Programs and Features instead, and then skip to Step 4. ![image](https://hackmd.io/_uploads/r14NneEgC.png) 3. Select Programs and Features. ![image](https://hackmd.io/_uploads/SJFN2g4x0.png) 4. Select Turn Windows features on or off from the left pane. ![image](https://hackmd.io/_uploads/rkh42l4eA.png) 5. Select the check box next to Telnet Client. ![image](https://hackmd.io/_uploads/rJySnxNeA.png) 6. Select OK to enable Telnet. 7. Execute Telnet Commands in Windows Telnet commands are easy to execute. After opening Command Prompt, enter the word telnet. The result is a line that says Microsoft Telnet>, which is where commands are entered. ![image](https://hackmd.io/_uploads/ryHD3lNx0.png) To connect to a Telnet server, enter a command that follows this syntax: `telnet hostname port` 8. Examples: - `telnet localhost 3000` -> connect to your port 3000 in localhost - `telnet towel.blinkenlights.nl` -> watch starwars in ASCII version XD