014.01.32.5. Explain the steps involved in adding and deleting routes using the "ip route" command, particularly focusing on setting the default gateway and adding routes for specific subnets. Why is it important to consider the complexity of configuring routes and ensuring proper routing for connected subnets?
With the interface up, you can add default routes just like this: ip route add default via gw-address dev interface , here the gw-address is the default IP address for gateway .
To remove the default gateway, use: ip route del default .
To add a route use this command: ip route add 192.168.45.0/24 via 10.23.2.44 , here the former is the subnet address and latter is the host address.
To delete a route use: ip route del 192.168.45.0/24.
Configuring routes is often more complicated than it appears. For e.g, while routing for all hosts on 192.168.45.0/24 can lead back to 10.23.2.0/24, or the first route added is basically useless.
Here are the steps involved in adding and deleting routes:
1. To add a default route, use the command:
ip route add default via gw-address dev interface metric X
Here, gw-address is the default IP address for the gateway, interface is the network interface, and X is the metric value.
2. To remove the default gateway, use:
ip route del default
3. To add a specific route, use the command:
ip route add 192.168.45.0/24 via 10.23.2.44 dev interface
Here, 192.168.45.0/24 is the subnet address, 10.23.2.44 is the next hop, and interface is the network interface.
4. To delete a specific route, use:
ip route del 192.168.45.0/24
Configuring routes can be more complex than it seems. The order in which routes are added matters, and the system uses the first matching route it finds in the routing table.