Creating routes in Linux : Basic Linux routing
Add a route to a network:
#route add -net network/mask gw default-gateway
Example
#route add -net 10.10.10.0/24 gw 192.168.0.1
Adding default gateway
#route add default gw default-gateway
Example
#route add default gw 192.168.0.1
Adding a route to specific host
#route add -host host-name gw default-gateway
Example:
#rotue add -host 2.34.5.6 gw 192.168.0.1
Deleting route to a network
#route del -network network/subnet default-gateway
Example
#route del -net 10.10.10.0/24 gw 192.168.0.1
Deleting default gateway
#route del default gw default-gatway
Example :
#route del default gw 192.168.0.1
Deleting specific host from routing table
#route del -host ip-add gw default-gateway
Example
#route del -host 10.10.10.45 gw 192.168.0.1
Seeing routing table
#netstat -rn
#route
Note : The old gate way will still remain and may need to be taken out for the system to function properly. Routes are made permanent in Red Hat Linux by adding routes to/etc/sysconfig/static-routes.
Add a route to a network:
#route add -net network/mask gw default-gateway
Example
#route add -net 10.10.10.0/24 gw 192.168.0.1
Adding default gateway
#route add default gw default-gateway
Example
#route add default gw 192.168.0.1
Adding a route to specific host
#route add -host host-name gw default-gateway
Example:
#rotue add -host 2.34.5.6 gw 192.168.0.1
Deleting route to a network
#route del -network network/subnet default-gateway
Example
#route del -net 10.10.10.0/24 gw 192.168.0.1
Deleting default gateway
#route del default gw default-gatway
Example :
#route del default gw 192.168.0.1
Deleting specific host from routing table
#route del -host ip-add gw default-gateway
Example
#route del -host 10.10.10.45 gw 192.168.0.1
Seeing routing table
#netstat -rn
#route
Note : The old gate way will still remain and may need to be taken out for the system to function properly. Routes are made permanent in Red Hat Linux by adding routes to/etc/sysconfig/static-routes.
No comments:
Post a Comment