Routing Basics
As most of people doesnt know that linux/*nix systems can be used as routers, even there is a project called Linux routing and seperate Linux OS routing purpose alone thats the flexibility of Linux.
In linux/*nix every work can be done in two ways, ie one temporary way(after reboots these changes will not be there) and second one is perminant way(after reboots too the changes will be there)
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 form 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 gw 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
As most of people doesnt know that linux/*nix systems can be used as routers, even there is a project called Linux routing and seperate Linux OS routing purpose alone thats the flexibility of Linux.
In linux/*nix every work can be done in two ways, ie one temporary way(after reboots these changes will not be there) and second one is perminant way(after reboots too the changes will be there)
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 form 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 gw 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