Linux route Add Command Examples

Originally published at: https://www.cyberciti.biz/faq/linux-route-add/

I am a new Linux user. How do I add a new or default gateway using route command on Linux operating systems? How can I use route command to show or set a new route on Linux based server or desktop system?

Hi
for default gateway:
route add default gw {default gateway ip}

for another route’s:
route add -net {ip} netmask {netmask} gw {gateway}