Difference between revisions of "Route (command)"

From wikieduonline
Jump to navigation Jump to search
Line 7: Line 7:
  
 
* Add default router:  
 
* Add default router:  
** <code>route add default gw 192.168.1.254 eth0</code>
+
 
 +
<code>route add default gw 192.168.1.254 eth0</code>
 +
 
 
* Add route to an specific [[subnet]]:
 
* Add route to an specific [[subnet]]:
** <code>route add -net 10.10.10.0/24 dev eth0</code>
 
* <code>[[netstat]] -rn</code>
 
* <code>[[ip route show]]</code>
 
  
* <code>[[route del]]</code>
+
<code>route add -net 10.10.10.0/24 dev eth0</code>
* <code>route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth0</code>
+
 
 +
<code>[[netstat]] -rn</code>
 +
 
 +
<code>[[ip route show]]</code>
 +
 
 +
<code>[[route del]]</code>
 +
 
 +
<code>route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth0</code>
  
 
== Basic Windows commands ==
 
== Basic Windows commands ==

Revision as of 13:04, 14 October 2021

route is a Linux command and Windows used to view and manipulate the IP routing table in Linux, Unix-like and Windows.


Basic Linux commands

Man page: https://linux.die.net/man/8/route

  • Add default router:

route add default gw 192.168.1.254 eth0

  • Add route to an specific subnet:

route add -net 10.10.10.0/24 dev eth0

netstat -rn

ip route show

route del

route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth0

Basic Windows commands

  • route delete 10.10.10.10
  • route delete 0.0.0.0 mask 0.0.0.0 XXX 10.10.10.10
  • route print

MacOS

  • route add default xx.xx.xx.xx
  • route del default

Network configuration files

  • Ubuntu (systemd): networkctl
    • /lib/systemd/network, the volatile runtime network directory /run/systemd/network
    • /etc/systemd/network


Related commands: ip route [show|xxx]


PAN-OS

Related terms

See also

Advertising: