Comandos de la terminal/ip

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

IP

ip addr

[root@pwyr ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff
    inet 192.168.51.51/24 brd 192.168.51.255 scope global enp63s0
       valid_lft forever preferred_lft forever
    inet6 fe80::222:64ff:feb5:1b31/64 scope link 
       valid_lft forever preferred_lft forever

[root@pwyr ~]# ip addr show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff
    inet 192.168.51.51/24 brd 192.168.51.255 scope global enp63s0
       valid_lft forever preferred_lft forever
    inet6 fe80::222:64ff:feb5:1b31/64 scope link 
       valid_lft forever preferred_lft forever

ip link

[root@pwyr ~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff

[root@pwyr ~]# ip link show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff

# Mostrar estadísticas
[root@pwyr ~]# ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    3068       50       0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    3068       50       0       0       0       0       
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    726964638  807366   0       0       0       101778  
    TX: bytes  packets  errors  dropped carrier collsns 
    24196212   306168   0       0       0       0

ip route

[root@pwyr ~]# ip route
default via 192.168.51.1 dev enp63s0  metric 10 
169.254.0.0/16 dev enp63s0  scope link  metric 10 
192.168.51.0/24 dev enp63s0  proto kernel  scope link  src 192.168.51.51  metric 10

ip maddr

# Mostrar Multicast IPs
[root@pwyr ~]# ip maddr
1:	lo
	inet  224.0.0.1
	inet6 ff02::1
	inet6 ff01::1
2:	enp63s0
	link  33:33:00:00:00:01
	link  01:00:5e:00:00:01
	link  33:33:ff:b5:1b:31
	link  33:33:00:01:00:03
	link  01:00:5e:00:00:fc
	link  33:33:00:00:02:02
	inet  224.0.0.252
	inet  224.0.0.1
	inet6 ff02::202
	inet6 ff02::1:3
	inet6 ff02::1:ffb5:1b31
	inet6 ff02::1
	inet6 ff01::1

[root@pwyr ~]# ip maddr show dev enp63s0
2:	enp63s0
	link  33:33:00:00:00:01
	link  01:00:5e:00:00:01
	link  33:33:ff:b5:1b:31
	link  33:33:00:01:00:03
	link  01:00:5e:00:00:fc
	link  33:33:00:00:02:02
	inet  224.0.0.252
	inet  224.0.0.1
	inet6 ff02::202
	inet6 ff02::1:3
	inet6 ff02::1:ffb5:1b31
	inet6 ff02::1
	inet6 ff01::1

ip neigh

[root@pwyr ~]# ip neigh
192.168.51.1 dev enp63s0 lladdr c4:6e:1f:56:7c:09 STALE
192.168.51.53 dev enp63s0 lladdr d0:53:49:30:5c:10 DELAY
fe80::88f8:afff:feea:376 dev enp63s0 lladdr c4:6e:1f:56:7c:09 router STALE

[root@pwyr ~]# ip neigh show dev enp63s0
192.168.51.1 lladdr c4:6e:1f:56:7c:09 STALE
192.168.51.53 lladdr d0:53:49:30:5c:10 REACHABLE
fe80::88f8:afff:feea:376 lladdr c4:6e:1f:56:7c:09 router STALE

[root@pwyr ~]# ping 192.168.51.30
PING 192.168.51.30 (192.168.51.30) 56(84) bytes of data.
From 192.168.51.51 icmp_seq=1 Destination Host Unreachable
^C
--- 192.168.51.30 ping statistics ---
6 packets transmitted, 0 received, +4 errors, 100% packet loss, time 5000ms
pipe 4
[root@pwyr ~]# ping 192.168.51.2
PING 192.168.51.2 (192.168.51.2) 56(84) bytes of data.
64 bytes from 192.168.51.2: icmp_seq=1 ttl=64 time=0.461 ms
64 bytes from 192.168.51.2: icmp_seq=2 ttl=64 time=0.228 ms
^C
--- 192.168.51.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.228/0.344/0.461/0.117 ms
[root@pwyr ~]# ping 192.168.51.53
PING 192.168.51.53 (192.168.51.53) 56(84) bytes of data.
64 bytes from 192.168.51.53: icmp_seq=1 ttl=64 time=36.2 ms
64 bytes from 192.168.51.53: icmp_seq=2 ttl=64 time=1.40 ms
^C
--- 192.168.51.53 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 1.408/13.324/36.223/16.196 ms
[root@pwyr ~]# ip neigh
192.168.51.30 dev enp63s0  FAILED
192.168.51.1 dev enp63s0 lladdr c4:6e:1f:56:7c:09 STALE
192.168.51.50 dev enp63s0 lladdr 48:13:7e:f9:66:15 STALE
192.168.51.53 dev enp63s0 lladdr d0:53:49:30:5c:10 REACHABLE
192.168.51.2 dev enp63s0 lladdr 00:21:5e:67:c7:d1 REACHABLE
fe80::88f8:afff:feea:376 dev enp63s0 lladdr c4:6e:1f:56:7c:09 router STALE

ip help

[root@pwyr ~]# ip help
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | tcp_metrics | token | netconf }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec |
                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}

[root@pwyr ~]# ip addr help
Usage: ip address {add|change|replace} IFADDR dev IFNAME [ LIFETIME ]
                                                      [ CONFFLAG-LIST ]
       ip address del IFADDR dev IFNAME [mngtmpaddr]
       ip address {show|save|flush} [ dev IFNAME ] [ scope SCOPE-ID ]
                            [ to PREFIX ] [ FLAG-LIST ] [ label LABEL ] [up]
       ip address {showdump|restore}
IFADDR := PREFIX | ADDR peer PREFIX
          [ broadcast ADDR ] [ anycast ADDR ]
          [ label IFNAME ] [ scope SCOPE-ID ]
SCOPE-ID := [ host | link | global | NUMBER ]
FLAG-LIST := [ FLAG-LIST ] FLAG
FLAG  := [ permanent | dynamic | secondary | primary |
           [-]tentative | [-]deprecated | [-]dadfailed | temporary |
           CONFFLAG-LIST ]
CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG
CONFFLAG  := [ home | nodad | mngtmpaddr | noprefixroute | autojoin ]
LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]
LFT := forever | SECONDS

[root@pwyr ~]# ip link help
Usage: ip link add [link DEV] [ name ] NAME
                   [ txqueuelen PACKETS ]
                   [ address LLADDR ]
                   [ broadcast LLADDR ]
                   [ mtu MTU ] [index IDX ]
                   [ numtxqueues QUEUE_COUNT ]
                   [ numrxqueues QUEUE_COUNT ]
                   type TYPE [ ARGS ]
       ip link delete { DEVICE | dev DEVICE | group DEVGROUP } type TYPE [ ARGS ]

       ip link set { DEVICE | dev DEVICE | group DEVGROUP } [ { up | down } ]
	                  [ arp { on | off } ]
	                  [ dynamic { on | off } ]
	                  [ multicast { on | off } ]
	                  [ allmulticast { on | off } ]
	                  [ promisc { on | off } ]
	                  [ trailers { on | off } ]
	                  [ txqueuelen PACKETS ]
	                  [ name NEWNAME ]
	                  [ address LLADDR ]
	                  [ broadcast LLADDR ]
	                  [ mtu MTU ]
	                  [ netns PID ]
	                  [ netns NAME ]
	                  [ link-netnsid ID ]
			  [ alias NAME ]
	                  [ vf NUM [ mac LLADDR ]
				   [ vlan VLANID [ qos VLAN-QOS ] ]
				   [ rate TXRATE ] ]
				   [ spoofchk { on | off} ] ]
				   [ query_rss { on | off} ] ]
				   [ state { auto | enable | disable} ] ]
			  [ master DEVICE ]
			  [ nomaster ]
			  [ addrgenmode { eui64 | none } ]
	                  [ protodown { on | off } ]
       ip link show [ DEVICE | group GROUP ] [up] [master DEV] [type TYPE]
       ip link help [ TYPE ]

TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | macvtap |
          bridge | bond | ipoib | ip6tnl | ipip | sit | vxlan |
          gre | gretap | ip6gre | ip6gretap | vti | nlmon |
          bond_slave | ipvlan | geneve | bridge_slave | vrf }

[root@pwyr ~]# ip neigh help
Usage: ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ]
          [ nud { permanent | noarp | stale | reachable } ]
          | proxy ADDR } [ dev DEV ]
       ip neigh {show|flush} [ to PREFIX ] [ dev DEV ] [ nud STATE ]

ip addr add

[root@pwyr ~]# ip addr add 10.51.1.1/24 dev enp63s0
[root@pwyr ~]# ip addr show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff
    inet 192.168.51.51/24 brd 192.168.51.255 scope global enp63s0
       valid_lft forever preferred_lft forever
    inet 10.51.1.1/24 scope global enp63s0
       valid_lft forever preferred_lft forever
    inet6 fe80::222:64ff:feb5:1b31/64 scope link 
       valid_lft forever preferred_lft forever

ip addr del

[root@pwyr ~]# ip addr del 10.51.1.1/24 dev enp63s0
[root@pwyr ~]# ip addr show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff
    inet 192.168.51.51/24 brd 192.168.51.255 scope global enp63s0
       valid_lft forever preferred_lft forever
    inet6 fe80::222:64ff:feb5:1b31/64 scope link 
       valid_lft forever preferred_lft forever

ip link set

[root@pwyr ~]# ip link set enp63s0 down
[root@pwyr ~]# ip link show dev enp63s0
2: enp63s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff

[root@pwyr ~]# ip link set enp63s0 uo
[root@pwyr ~]# ip link show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff

[root@pwyr ~]# ip link set enp63s0 promisc on
[root@pwyr ~]# ip link show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff

[root@pwyr ~]# ip link set enp63s0 promisc off
[root@pwyr ~]# ip link show dev enp63s0
2: enp63s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:22:64:b5:1b:31 brd ff:ff:ff:ff:ff:ff