Linux "IP" Networking
-
"IP" Syntax, Options etc:
ip [ OPTIONS ] OBJECT { COMMAND | help } OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | tcp_metrics | token | macsec | vrf | mptcp | ioam | stats } OPTIONS := { -V[ersion] | -h[uman-readable] | -s[tatistics] | -d[etails] | -r[esolve] | -iec | -f[amily] { inet | inet6 | link } | -4 | -6 | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -o[neline] | -rc[vbuf] [size] | -t[imestamp] | -ts[hort] | -n[etns] name | -N[umeric] | -a[ll] | -c[olor] | -br[ief] | -j[son] | -p[retty] }
Useful Options and Explanations:
-h, -human, -human-readable output statistics with human readable values followed by suffix. -s, -stats, -statistics Output more information. If the option appears twice or more, the amount of information increases. As a rule, the information is statistics or some time values. -c[color][={always|auto|never} Configure color output. If parameter is omitted or always, color output is enabled regardless of stdout state. If parameter is auto, stdout is checked to be a terminal before enabling color output. If parameter is never, color output is disabled. If specified multiple times, the last one takes precedence. This flag is ignored if -json is also given. -br, -brief Print only basic information in a tabular format for better readability. This option is currently only supported by ip addr show , ip link show & ip neigh show commands.
List interfaces:
root@QBIT0718:~# ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether d6:36:f9:ed:47:af brd ff:ff:ff:ff:ff:ff altname enp0s18 3: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/none
Enable/Disable Interface:
ip link set dev enp0s8 up ip link set dev enp0s8 down
Check Interface Statistics:
root@QBIT0718:~# ip -s -s -c -h link show ens18 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether d6:36:f9:ed:47:af brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped missed mcast 19.4T 10.6G 0 1.58M 0 0 RX errors: length crc frame fifo overrun otherhost 0 0 0 0 0 70 TX: bytes packets errors dropped carrier collsns 14.8T 11.8G 0 0 0 0 TX errors: aborted fifo window heartbt transns 0 0 0 0 2 altname enp0s18
Add/Delte ip-address of interface:
(These changes are TEMPORARY until Reboot)ip a add 10.0.0.40/24 dev enp0s8 ip a del 10.0.0.40/24 dev enp0s8