🖥️route
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the route command with important options and switches using examples.
3 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██████╗ ██████╗ ██╗ ██╗████████╗███████╗
# ██╔══██╗██╔═══██╗██║ ██║╚══██╔══╝██╔════╝
# ██████╔╝██║ ██║██║ ██║ ██║ █████╗
# ██╔══██╗██║ ██║██║ ██║ ██║ ██╔══╝
# ██║ ██║╚██████╔╝╚██████╔╝ ██║ ███████╗
# ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
# To display routing table IP addresses instead of host names:
route -n
# To add a default gateway:
route add default gateway 192.168.0.1
# To add the normal loopback entry, using netmask 255.0.0.0 and associated with the "lo" device (assuming this device was previously set up correctly with ifconfig(8)).
route add -net 127.0.0.0 netmask 255.0.0.0 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 192.56.76.0 netmask 255.255.255.0 dev eth0
# To delete the current default route, which is labeled "default" or 0.0.0.0 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 192.57.66.0 netmask 255.255.255.0 gw ipx4
# To install a rejecting route for the private network "10.x.x.x."
route add -net 10.0.0.0 netmask 255.0.0.0 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 224.0.0.0 netmask 240.0.0.0 dev eth0
# route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254
route add -net $destination gw $gateway
# add route default gateway on shell # route add default gateway
route add default gw 192.168.10.1
#//OR//
ip route add default via 192.168.10.1 dev eth0
# //OR//
ip route add default via 192.168.10.1
#Delete current default gw
route del default gw 192.168.1.1 eth0
#Add default gw
route add default gw 192.168.1.1 eth0
ip route add default via 192.168.1.254
/etc/init.d/networking restart
#==============================##==============================#
# CMD ROUTE #
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command route in a clear format. This allows users to quickly access the needed information for route without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for route are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.