ip

ByAdmin

Feb 8, 2020

ip parametre

Brug

Bruges til at se eller ændre netværk  informationer.

Parametre

ip [ OPTIONS ] OBJECT { COMMAND | help }

OPTIONS := { -V[ersion] | -h[uman-readable] | -s[tatistics] | -d[etails] | -r[esolve] | -iec | -f[amily] { inet | inet6 | ipx | dnet | link } | -4 | -6 | -I |
-D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -o[neline] | -rc[vbuf] [size] | -t[imestamp] | -ts[hort] | -n[etns] name | -a[ll] | -c[olor]
-br[ief] }

OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | tcp_met‐
rics | token | macsec }

 

Eksempler

Viser alle netkort info.

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp14s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 14:da:e9:2b:01:01 brd ff:ff:ff:ff:ff:ff
3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 14:da:e9:2b:08:b0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.10/24 brd 192.168.0.255 scope global noprefixroute eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::50e1:be43:cfe2:3dec/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: wlp13s1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:18:e7:5f:b5:13 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.177/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp13s1
       valid_lft 6914sec preferred_lft 6914sec
    inet6 fe80::14ea:8cce:1656:d3a/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

 

For at se på et enkelt netkort skriver du interface navnet efter show.

$ ip address show dev eno1

 

For at se routnings informationer.

Routings informationer.

$ ip route
default via 192.168.0.1 dev eno1 proto dhcp metric 100 
default via 192.168.0.1 dev wlp13s1 proto dhcp metric 600 
169.254.0.0/16 dev virbr0 scope link metric 1000 linkdown 
192.168.0.0/24 dev eno1 proto kernel scope link src 192.168.0.10 metric 100 
192.168.0.0/24 dev wlp13s1 proto kernel scope link src 192.168.0.177 metric 600 
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

 

For at tilføje ip adresse til et netkort bruges add parameteren til address.

$ sudo ip address add dev virbr0 192.168.2.10

For at fjerne ip adressen igen bruges del som vist her.

$ sudo ip address del dev virbr0 192.168.2.10

 

Loading

By Admin

Author: Jeg er en professionel system administrator og grundlægger af linuxboxen.dk Jeg er en ivrig Linux-elsker og open source-entusiast. Jeg bruger Ubuntu og tror på at dele viden. Bortset fra Linux, elsker musik og dyr. Jeg er en stor fan af Dire straits.

Leave a Reply

Your email address will not be published. Required fields are marked *