LAN monitor

-------

Speed Test Server Network

yum install epel-release -y

yum install python python-pip -y 

pip install --upgrade pip

pip install speedtest-cli

speedtest-cli # speedtest-cli

Retrieving speedtest.net configuration... Retrieving speedtest.net server list... Testing from WorldStream (109.236.84.3)... Selecting best server based on latency... Hosted by SoftLayer Technologies, Inc. (Amsterdam) [33.82 km]: 4.409 ms Testing download speed........................................ Download: 384.73 Mbit/s Testing upload speed.................................................. Upload: 367.74 Mbit/s

iftop – display bandwidth usage on an interface

#   iftop -i eno1

Command to check network adapter names in Linux

[root@tswl ~]#  lshw -class network -short

H/W path               Device      Class          Description

=============================================================

/0/1/0/3/0             eno1        network        Ethernet Connection X722 for 1GbE

/0/1/0/3/0.1           eno2        network        Ethernet Connection X722 for 1GbE

/0/1/0/3/0.2           eno3        network        Ethernet Connection X722 for 1GbE

/0/1/0/3/0.3           eno4        network        Ethernet Connection X722 for 1GbE

/3                     dummy0      network        Ethernet interface

/4                     virbr0-nic  network        Ethernet interface

/5                     virbr0      network        Ethernet interface

Ethernet device is up or down

[root@tswl ~]# nmcli device status

DEVICE      TYPE      STATE        CONNECTION 

eno1        ethernet  connected    eno1       

eno2        ethernet  connected    eno2       

virbr0      bridge    connected    virbr0     

virbr0-nic  tun       connected    virbr0-nic 

eno3        ethernet  unavailable  --         

eno4        ethernet  unavailable  --         

dummy0      dummy     unmanaged    --         

lo          loopback  unmanaged    -- 

Packet Load Ping

[root@tswl ~]#  ping -s 1024 8.8.8.8

change the state of the device to UP or DOWN

ip link set dev {DEVICE} {up|down}

# ip link set dev eth1 down

# ip link set dev eth1 up

change the MTU of the device

ip link set mtu {NUMBER} dev {DEVICE}

# ifconfig eth1 mtu 9000 up

# ip link set mtu 1300 dev eth0

# ip a list eth0

 all network interface including received and send packets

# netstat -i

Kernel Interface table Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg eth0       1500 0   1955323      0      0 0       1563543      0      0      0 BMRU lo        16436 0     27472      0      0 0         27472      0      0      0 LRU

Kernel Interface ERROR

Displaying Kernel IP routing

# netstat -r  Kernel IP routing table Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface 192.168.0.0     *               255.255.255.0   U         0 0          0 eth0 link-local      *               255.255.0.0     U         0 0          0 eth0 default         192.168.0.1     0.0.0.0         UG        0 0          0 eth0

Listing all active listening ports connections with netstat -l.

# netstat -l  Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address               Foreign Address             State tcp        0      0 *:sunrpc                    *:*                         LISTEN tcp        0      0 *:58642                     *:*                         LISTEN tcp        0      0 *:ssh                       *:*                         LISTEN udp        0      0 *:35036                     *:* udp        0      0 *:npmp-local                *:*  Active UNIX domain sockets (only servers) Proto RefCnt Flags       Type       State         I-Node Path unix  2      [ ACC ]     STREAM     LISTENING     16972  /tmp/orbit-root/linc-76b-0-6fa08790553d6 unix  2      [ ACC ]     STREAM     LISTENING     17149  /tmp/orbit-root/linc-794-0-7058d584166d2 unix  2      [ ACC ]     STREAM     LISTENING     17161  /tmp/orbit-root/linc-792-0-546fe905321cc unix  2      [ ACC ]     STREAM     LISTENING     15938  /tmp/orbit-root/linc-74b-0-415135cb6aeab

# ip -s link show eno1 

2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000     link/ether 00:1e:4f:c8:43:fc brd ff:ff:ff:ff:ff:ff     RX: bytes  packets  errors  dropped overrun mcast     224258568  418718   0       0       0       84376     TX: bytes  packets  errors  dropped carrier collsns     6131373    78152    0       0       0       0

# ip route show

 default via 192.168.0.1 dev enp0s25 proto static metric 100 169.254.0.0/16 dev enp0s25 scope link metric 1000 192.168.0.0/24 dev enp0s25 proto kernel scope link src 192.168.0.24 metric 100

[root@mail postfix]# netstat -lnp |grep :25

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      25792/master

Old vs. new tool

Deprecated Linux command and their replacement cheat sheet:

root@mail ~]# dig +short myip.opendns.com @resolver1.opendns.com

207.76.248.149

[root@mail ~]#    curl https://ipinfo.io/ip ; echo

275.229.184.259

[root@mail ~]#       route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         175.29.184.57   0.0.0.0         UG    100    0        0 em1

175.29.184.0    0.0.0.0         255.255.248.0   U     100    0        0 em1

192.168.9.0     0.0.0.0         255.255.255.0   U     101    0        0 em2

192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

[root@mail ~]#      netstat -rn

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

0.0.0.0         175.29.184.57   0.0.0.0         UG        0 0          0 em1

175.29.184.0    0.0.0.0         255.255.248.0   U         0 0          0 em1

192.168.9.0     0.0.0.0         255.255.255.0   U         0 0          0 em2

192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0



Netstat

netstat -nat  [show ports allow]

netstat -ni    [ show interface error]

netstat -r

netstat -i       [Show the list of network interface]

netstat -ie      [Display extended information on the interfaces]








Category

List of Unix and Linux commands

----