Comandos de la terminal/route

De WikiCabal
Ir a la navegación Ir a la búsqueda

route

[root@Llawyr ~]# route --help
Usage: route [-nNvee] [-FC] [<AF>]           List kernel routing tables
       route [-v] [-FC] {add|del|flush} ...  Modify routing table for AF.

       route {-h|--help} [<AF>]              Detailed usage syntax for specified AF.
       route {-V|--version}                  Display version/author and exit.

        -v, --verbose            be verbose
        -n, --numeric            don't resolve names
        -e, --extend             display other/more information
        -F, --fib                display Forwarding Information Base (default)
        -C, --cache              display routing cache instead of FIB

  <AF>=Use '-A <af>' or '--<af>'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 

[root@Llawyr ~]# route --version
net-tools 1.60
route 1.98 (2001-04-15)
+NEW_ADDRT +RTF_IRTT +RTF_REJECT +I18N
AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK +ECONET +ROSE 
HW:  +ETHER +ARC +SLIP +PPP +TUNNEL -TR +AX25 +NETROM +X25 +FR +ROSE +ASH +SIT +FDDI +HIPPI +HDLC/LAPB 

route es desfasado, Debemos utilizar el comando ip

[root@Llawyr ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.51.1    0.0.0.0         UG    35     0        0 wlp3s0
169.254.0.0     0.0.0.0         255.255.0.0     U     35     0        0 wlp3s0
192.168.51.0    0.0.0.0         255.255.255.0   U     35     0        0 wlp3s0

[root@Llawyr ~]# ifconfig enp4s0 10.11.12.13 netmask 255.255.0.0 -promisc up

[root@Llawyr ~]# ifconfig  enp4s0
enp4s0    Link encap:Ethernet  HWaddr 10:BF:48:08:02:FB  
          inet addr:10.11.12.13  Bcast:10.11.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@Llawyr ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.51.1    0.0.0.0         UG    35     0        0 wlp3s0
10.11.0.0       0.0.0.0         255.255.0.0     U     0      0        0 enp4s0
169.254.0.0     0.0.0.0         255.255.0.0     U     35     0        0 wlp3s0
192.168.51.0    0.0.0.0         255.255.255.0   U     35     0        0 wlp3s0

[root@Llawyr ~]# route add -net 172.16.0.0 netmask 255.255.255.0 gw 10.11.12.13 enp4s0

[root@Llawyr ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.51.1    0.0.0.0         UG    35     0        0 wlp3s0
10.11.0.0       0.0.0.0         255.255.0.0     U     0      0        0 enp4s0
169.254.0.0     0.0.0.0         255.255.0.0     U     35     0        0 wlp3s0
172.16.0.0      10.11.12.13     255.255.255.0   UG    0      0        0 enp4s0
192.168.51.0    0.0.0.0         255.255.255.0   U     35     0        0 wlp3s0

[root@Llawyr ~]# route del -net 169.254.0.0  netmask  255.255.0.0

[root@Llawyr ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.51.1    0.0.0.0         UG    35     0        0 wlp3s0
10.11.0.0       0.0.0.0         255.255.0.0     U     0      0        0 enp4s0
172.16.0.0      10.11.12.13     255.255.255.0   UG    0      0        0 enp4s0
192.168.51.0    0.0.0.0         255.255.255.0   U     35     0        0 wlp3s0

Flags:
              U (route is up)
              H (target is a host)
              G (use gateway)
              R (reinstate route for dynamic routing)
              D (dynamically installed by daemon or redirect)
              M (modified from routing daemon or redirect)
              A (installed by addrconf)
              C (cache entry)
              !  (reject route)

route add default gw NombreDelEnlace

[root@Llawyr ~]# route add -net 10.11.0.0 netmask 255.255.0.0 reject

[root@Llawyr ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.51.1    0.0.0.0         UG    35     0        0 wlp3s0
10.11.0.0       -               255.255.0.0     !     0      -        0 -
10.11.0.0       0.0.0.0         255.255.0.0     U     0      0        0 enp4s0
172.16.0.0      10.11.12.13     255.255.255.0   UG    0      0        0 enp4s0
192.168.51.0    0.0.0.0         255.255.255.0   U     35     0        0 wlp3s0

[root@Llawyr ~]# route del -net 10.11.0.0 netmask 255.255.0.0 enp4s0

[root@Llawyr ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.51.1    0.0.0.0         UG    35     0        0 wlp3s0
10.11.0.0       -               255.255.0.0     !     0      -        0 -
172.16.0.0      10.11.12.13     255.255.255.0   UG    0      0        0 enp4s0
192.168.51.0    0.0.0.0         255.255.255.0   U     35     0        0 wlp3s0