ROUTE Commands Cheat Sheet

Here is a cli commands cheat sheet for ROUTE command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is ROUTE command?

Add some data here

        # To display routing table IP addresses instead of host names:
route -n

# To add a default gateway:
route add default gateway

# To add the normal loopback entry, using netmask and associated with
# the "lo" device (assuming this device was previously set up correctly with
# ifconfig(8)):
route add -net netmask dev lo

# To add a route to the local network 192.56.76.x via "eth0".  The word "dev" can be omitted here:
route add -net netmask dev eth0

# To delete the current default route, which is labeled "default" or in the destination field of the current routing table:
route del default

# To add a default  route (which will be used if no other route matches).  All
# packets using this route will be gatewayed through "mango-gw". The device
# which will actually be used for that route depends on how we can reach
# "mango-gw" - the static route to "mango-gw" will have to be set up before:
route add default gw mango-gw

# To add the route to the "ipx4" host via the SLIP interface (assuming that "ipx4" is the SLIP host):
route add ipx4 sl0

# To add the net "192.57.66.x" to be gateway through the former route to the SLIP interface:
route add -net netmask gw ipx4

# To install a rejecting route for the private network "10.x.x.x.":
route add -net netmask reject

# This is an obscure one documented so people know how to do it. This sets all
# of the class D (multicast) IP routes to go via "eth0". This is the correct
# normal configuration line with a multicasting kernel:
route add -net netmask dev eth0

Check out the ROUTE command documentation .

You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list