Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Network Related Info, Commands, Etc

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

Note: After setting up ACT Fibernet & using the same connection with LAN Card.

## If migrating from prior bintray install instructions please first...


# sudo rm /etc/apt/sources.list.d/speedtest.list
# sudo apt-get update
# sudo apt-get remove speedtest

## Other non-official binaries will conflict with Speedtest CLI


# Example how to remove using apt-get
# sudo apt-get remove speedtest-cli
sudo apt-get install curl
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
sudo apt-get install speedtest

av@Hamsathwani:~$ date
Friday 04 February 2022 11:31:08 PM IST

av@Hamsathwani:~$ lspci -nn


00:00.0 Host bridge [0600]: Intel Corporation 2nd Generation Core Processor Family DRAM Controller
[8086:0104] (rev 09)
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI
Express Root Port [8086:0101] (rev 09)
00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family
Integrated Graphics Controller [8086:0126] (rev 09)
00:16.0 Communication controller [0780]: Intel Corporation 6 Series/C200 Series Chipset Family MEI
Controller #1 [8086:1c3a] (rev 04)
00:1a.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced
Host Controller #2 [8086:1c2d] (rev 05)
00:1b.0 Audio device [0403]: Intel Corporation 6 Series/C200 Series Chipset Family High Definition
Audio Controller [8086:1c20] (rev 05)
00:1c.0 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root
Port 1 [8086:1c10] (rev b5)
00:1c.1 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root
Port 2 [8086:1c12] (rev b5)
00:1c.3 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root
Port 4 [8086:1c16] (rev b5)
00:1c.4 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root
Port 5 [8086:1c18] (rev b5)
00:1c.5 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root
Port 6 [8086:1c1a] (rev b5)
00:1d.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced
Host Controller #1 [8086:1c26] (rev 05)
00:1f.0 ISA bridge [0601]: Intel Corporation HM67 Express Chipset LPC Controller [8086:1c4b] (rev
05)
00:1f.2 SATA controller [0106]: Intel Corporation 6 Series/C200 Series Chipset Family 6 port
Mobile SATA AHCI Controller [8086:1c03] (rev 05)
00:1f.3 SMBus [0c05]: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller
[8086:1c22] (rev 05)
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF108M [GeForce GT 525M] [10de:0df5]
(rev a1)
03:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43224 802.11a/b/g/n
[14e4:4353] (rev 01)
04:00.0 USB controller [0c03]: NEC Corporation uPD720200 USB 3.0 Host Controller [1033:0194] (rev
04)
05:00.0 System peripheral [0880]: JMicron Technology Corp. SD/MMC Host Controller [197b:2392] (rev
30)
05:00.2 SD Host controller [0805]: JMicron Technology Corp. Standard SD Host Controller
[197b:2391] (rev 30)
05:00.3 System peripheral [0880]: JMicron Technology Corp. MS Host Controller [197b:2393] (rev 30)
05:00.4 System peripheral [0880]: JMicron Technology Corp. xD Host Controller [197b:2394] (rev 30)
06:00.0 Ethernet controller [0200]: Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet [1969:1083] (rev
c0)

av@Hamsathwani:~$ sudo lshw -C network


[sudo] password for av:
Sorry, try again.
[sudo] password for av:
*-network
description: Wireless interface
product: BCM43224 802.11a/b/g/n
vendor: Broadcom Inc. and subsidiaries
physical id: 0
bus info: pci@0000:03:00.0
logical name: wlp3s0
version: 01
serial: 00:26:82:92:28:a4
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=wl0 driverversion=6.30.223.271 (r587334) latency=0
multicast=yes wireless=IEEE 802.11
resources: irq:9 memory:f1b00000-f1b03fff
*-network
description: Ethernet interface
product: AR8151 v2.0 Gigabit Ethernet
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:06:00.0
logical name: enp6s0
version: c0
serial: 92:8e:a7:df:94:ca
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd
100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion=5.13.0-28-
generic duplex=full ip=192.168.0.2 latency=0 link=yes multicast=yes port=twisted pair
speed=100Mbit/s
resources: irq:28 memory:f1800000-f183ffff ioport:2000(size=128)
av@Hamsathwani:~$

###################

Internet was too slow (ACT Fibernet – using Ethernet LAN Cable):

av@Hamsathwani:~$ date
Friday 18 February 2022 10:50:46 PM IST

Uncommented the highlighted (red) line in the file below and saved.
Source: https://askubuntu.com/questions/1230525/ubuntu-20-04-network-performance-extremely-slow

av@Hamsathwani:~$ sudo gedit /etc/gai.conf


[sudo] password for av:
# Configuration for getaddrinfo(3).
#
# So far only configuration for the destination address sorting is needed.
# RFC 3484 governs the sorting. But the RFC also says that system
# administrators should be able to overwrite the defaults. This can be
# achieved here.
#
# All lines have an initial identifier specifying the option followed by
# up to two values. Information specified in this file replaces the
# default information. Complete absence of data of one kind causes the
# appropriate default information to be used. The supported commands include:
#
# reload <yes|no>
# If set to yes, each getaddrinfo(3) call will check whether this file
# changed and if necessary reload. This option should not really be
# used. There are possible runtime problems. The default is no.
#
# label <mask> <value>
# Add another rule to the RFC 3484 label table. See section 2.1 in
# RFC 3484. The default is:
#
#label ::1/128 0
#label ::/0 1
#label 2002::/16 2
#label ::/96 3
#label ::ffff:0:0/96 4
#label fec0::/10 5
#label fc00::/7 6
#label 2001:0::/32 7
#
# This default differs from the tables given in RFC 3484 by handling
# (now obsolete) site-local IPv6 addresses and Unique Local Addresses.
# The reason for this difference is that these addresses are never
# NATed while IPv4 site-local addresses most probably are. Given
# the precedence of IPv6 over IPv4 (see below) on machines having only
# site-local IPv4 and IPv6 addresses a lookup for a global address would
# see the IPv6 be preferred. The result is a long delay because the
# site-local IPv6 addresses cannot be used while the IPv4 address is
# (at least for the foreseeable future) NATed. We also treat Teredo
# tunnels special.
#
# precedence <mask> <value>
# Add another rule to the RFC 3484 precedence table. See section 2.1
# and 10.3 in RFC 3484. The default is:
#
#precedence ::1/128 50
#precedence ::/0 40
#precedence 2002::/16 30
#precedence ::/96 20
#precedence ::ffff:0:0/96 10
#
# For sites which prefer IPv4 connections change the last line to
#
#precedence ::ffff:0:0/96 100

#
# scopev4 <mask> <value>
# Add another rule to the RFC 6724 scope table for IPv4 addresses.
# By default the scope IDs described in section 3.2 in RFC 6724 are
# used. Changing these defaults should hardly ever be necessary.
# The defaults are equivalent to:
#
#scopev4 ::ffff:169.254.0.0/112 2
#scopev4 ::ffff:127.0.0.0/104 2
#scopev4 ::ffff:0.0.0.0/96 14

# 2: Disable wi-fi power management.

av@Hamsathwani:~$ cat /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf


[connection]
wifi.powersave = 2

Since the wifi power management was disabled (as seen above) nothing was done.

# 3: Check the network capacity:


av@Hamsathwani:~$ sudo lshw -C network
*-network
description: Ethernet interface
product: AR8151 v2.0 Gigabit Ethernet
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:05:00.0
logical name: enp5s0
version: c0
serial: 5c:f9:dd:3e:78:5b
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd
100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion=5.13.0-30-
generic duplex=full ip=192.168.0.33 latency=0 link=yes multicast=yes port=twisted pair
speed=1Gbit/s
resources: irq:27 memory:f1800000-f183ffff ioport:2000(size=128)

Alternate way of finding Network device/interface capacity:


av@Hamsathwani:~$ cat /sys/class/net/enp5s0/speed
1000
Note: 1000 refers to 1000MB/s – which matches the capacity returned by lshw command

Another method (Network device/interface capacity):


(Note: This tool/command is used to trace files opened by programs)
av@Hamsathwani:~$ sudo strace -e trace=file -f -s128 lshw -class network
execve("/usr/bin/lshw", ["lshw", "-class", "network"], 0x7ffea8472d70 /* 26 vars */) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
access("/sys/class/.", F_OK) = 0
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
access("/sys/firmware/dmi/tables/smbios_entry_point", R_OK) = 0
access("/sys/firmware/dmi/tables/DMI", R_OK) = 0
openat(AT_FDCWD, "/sys/firmware/dmi/tables/smbios_entry_point", O_RDONLY) = 3
openat(AT_FDCWD, "/sys/firmware/dmi/tables/DMI", O_RDONLY) = 4
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 5
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/lshw.mo", O_RDONLY) = -1 ENOENT (No such
file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/lshw.mo", O_RDONLY) = -1 ENOENT (No such file
or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/lshw.mo", O_RDONLY) = -1 ENOENT (No
such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/lshw.mo", O_RDONLY) = -1 ENOENT (No
such file or directory)
openat(AT_FDCWD, "/sys/devices/system/cpu/online", O_RDONLY) = 3
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
getcwd("/home/av", 4097) = 9
chdir("/sys/devices/parisc") = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
lstat("acism", {st_mode=S_IFLNK|0777, st_size=60, ...}) = 0
lstat("snap", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Videos", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Downloads", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Desktop", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("dump", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat("Audio", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("acismProjects", {st_mode=S_IFLNK|0777, st_size=69, ...}) = 0
lstat("Templates", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Public", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Pictures", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Music", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Documents", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getcwd("/home/av", 4097) = 9
access("/proc/device-tree", F_OK) = -1 ENOENT (No such file or directory)
getcwd("/home/av", 4097) = 9
chdir("/proc/sys/dev/sensors") = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
lstat("acism", {st_mode=S_IFLNK|0777, st_size=60, ...}) = 0
lstat("snap", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Videos", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Downloads", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("Desktop", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("dump", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat("Audio", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("acismProjects", {st_mode=S_IFLNK|0777, st_size=69, ...}) = 0
lstat("Templates", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
....
...
...
unlink("/dev/fb-2946") = 0
mknod("/tmp/fb-2946", S_IFCHR|0400, makedev(0x1d, 0x1)) = 0
openat(AT_FDCWD, "/tmp/fb-2946", O_RDONLY) = -1 ENODEV (No such device)
unlink("/tmp/fb-2946") = 0
access("/sys/devices/system/cpu/cpu0/cpufreq/", F_OK) = 0
getcwd("/sys/bus/pnp/devices", 4097) = 21
chdir("/sys/devices/system/cpu/cpu0/cpufreq/") = 0
openat(AT_FDCWD, "cpuinfo_max_freq", O_RDONLY) = 4
openat(AT_FDCWD, "scaling_cur_freq", O_RDONLY) = 4
getcwd("/sys/devices/system/cpu/cpufreq/policy0", 4097) = 40
chdir("/sys/bus/pnp/devices") = 0
getcwd("/sys/bus/pnp/devices", 4097) = 21
chdir("/proc/sys") = 0
access("kernel/vsyscall64", F_OK) = -1 ENOENT (No such file or directory)
chdir("abi") = 0
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
lstat("vsyscall32", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
getcwd("/proc/sys/abi", 4097) = 14
chdir("/sys/bus/pnp/devices") = 0
*-network
description: Ethernet interface
product: AR8151 v2.0 Gigabit Ethernet
vendor: Qualcomm Atheros
physical id: 0
bus info: pci@0000:05:00.0
logical name: enp5s0
version: c0
serial: 5c:f9:dd:3e:78:5b
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd
100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion=5.13.0-30-
generic duplex=full ip=192.168.0.33 latency=0 link=yes multicast=yes port=twisted pair
speed=1Gbit/s
resources: irq:27 memory:f1800000-f183ffff ioport:2000(size=128)
+++ exited with 0 +++

To check the connected state of network cable:


av@Hamsathwani:~$ cat /sys/class/net/enp5s0/operstate
up

# 4: To change MAC address:


Source: https://askubuntu.com/questions/976411/how-can-i-automatically-change-my-mac-address-whenever-my-
network-device-is-up-o

Note: This doesn’t seem to be working. Need to check why.

av@Hamsathwani:/etc/network/if-up.d$ sudo gedit /etc/network/if-up.d/mac-changer


av@Hamsathwani:/etc/network/if-up.d$ sudo chmod +x /etc/network/if-up.d/mac-changer
av@Hamsathwani:/etc/network/if-up.d$ sudo gedit /etc/network/if-up.d/mac-changer

Copy the code below and paste it in the file created.

#!/bin/bash

change_mac(){
# Prevent enless loop on error
if (( COUNT >= 10 )); then exit 0; else COUNT=$(( COUNT + 1 )); echo "Attempt: $COUNT"; fi
# Generate a new MAC address
MAC="$(echo $RANDOM | md5sum | head -c 17 | sed -r 's/(..)./\1:/g')"
# Change the MAC address of the target network interface
/sbin/ifconfig "$1" hw ether "${MAC}"
# Chech whether the MAC is successfully changed anf if is not call the function again
if [ $? -ne 0 ]; then change_mac; fi
# Log the change
echo "Interface: $1 | MAC: $MAC"
}

# Call of the function; Change 'enp0s25' with the actual interface in use; Create a log file
`/tmp/mac-changer-...`
change_mac 'enp0s25' > /tmp/mac-changer-enp0s25 2>&1
Verify if the above script is working.

av@Hamsathwani:/etc/network/if-up.d$ ifconfig | grep ether


ether 5c:f9:dd:3e:78:5b txqueuelen 1000 (Ethernet)
av@Hamsathwani:/etc/network/if-up.d$ sh /etc/network/if-up.d/mac-changer
av@Hamsathwani:/etc/network/if-up.d$ ifconfig | grep ether
ether 5c:f9:dd:3e:78:5b txqueuelen 1000 (Ethernet)

Check the below file for logs:


av@Hamsathwani:/etc/network/if-up.d$ cat /tmp/mac-changer-enp5s0

# 5: Check if the connection is up and running:


Source-1: https://devconnected.com/network-manager-on-linux-with-examples/ (contains detailed info)
Source-2: https://serverfault.com/questions/880950/network-issue-ifup-says-unknown-interface

av@Hamsathwani:~$ sudo ifdown enp5s0


Killed old client process
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp5s0/5c:f9:dd:3e:78:5b
Sending on LPF/enp5s0/5c:f9:dd:3e:78:5b
Sending on Socket/fallback
DHCPRELEASE of 192.168.0.33 on enp5s0 to 192.168.0.1 port 67 (xid=0x50031766)

av@Hamsathwani:~$ nmcli conn sh


NAME UUID TYPE DEVICE
ACTFibernet-LAN dee9cb16-cb1f-4db0-acbd-09724f45ab8d ethernet --
MobileData-USBTethering 6117a625-0e10-4dd9-b210-a3d83f43ad5a ethernet --
Wi-Fi connection 1 cd46d8a9-799a-4beb-bad3-c18578fca94c wifi --

av@Hamsathwani:~$ cat /proc/net/dev


Inter-| Receive | Transmit

face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed

lo: 273071 2548 0 0 0 0 0 0 273071 2548 0 0 0 0 0 0

enp5s0: 67954770 84228 0 0 0 0 0 67 12661129 53315 0 0 0 0 1 0

av@Hamsathwani:~$ ls /sys/class/net/
enp5s0 lo

av@Hamsathwani:~$ ip link show


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: enp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default
qlen 1000
link/ether 5c:f9:dd:3e:78:5b brd ff:ff:ff:ff:ff:ff

av@Hamsathwani:~$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2568 bytes 274631 (274.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2568 bytes 274631 (274.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
av@Hamsathwani:~$ nmcli device show
GENERAL.DEVICE: enp5s0
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 5C:F9:DD:3E:78:5B
GENERAL.MTU: 1500
GENERAL.STATE: 10 (unmanaged)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
WIRED-PROPERTIES.CARRIER: off
IP4.GATEWAY: --
IP6.GATEWAY: --

GENERAL.DEVICE: lo
GENERAL.TYPE: loopback
GENERAL.HWADDR: 00:00:00:00:00:00
GENERAL.MTU: 65536
GENERAL.STATE: 10 (unmanaged)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
IP4.ADDRESS[1]: 127.0.0.1/8
IP4.GATEWAY: --
IP6.ADDRESS[1]: ::1/128
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = ::1/128, nh = ::, mt = 256

This command describes extensively your network adapter, it lists :

The device name : assigned by udev when the device was plugged to your computer (eth0 in this case);
Your device MAC address, referred here as the hardware address;
The device state : whether it is connected to the network or not;
The IPv4 address using a CIDR notation (192.168.1.16/24)
The IPv4 of your subnet gateway (192.168.1.1);
The IPv4 of your main DNS (192.168.1.1)

Note : here, the gateway is acting as the main DNS but you might have dedicated name servers in your company.

Those characteristics are quite useful if you want to list network cards available on your host and determine whether
they are connect or not.

Note that ifup and ifdown are only used to set up interfaces listed in /etc/network/interfaces. If a network interface
(for ex., enp5s0) is not described in this file, these commands won’t know what to do. So, first you need to configure
the details in the /etc/network/interfaces file. For ex.,

iface enp5s0 inet dhcp


Note: Also note that if the connection is managed by NetworkManager, then the configuration in
/etc/network/interfaces file wont’ have any effect. The configuraiton file for NetworkManager is as below.

av@Hamsathwani:~$ cat /etc/NetworkManager/NetworkManager.conf


[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no
Since it is configured as managed=false in the file, the network connection is managed by the NetworkManager ONLY
using the /etc/NetworkManager/NetworkManager.conf configuration & not using the /etc/network/interfaces
configuration file. So, any configuration in /etc/network/interfaces file will not have any effect (unless you use the
nmcli connection up <uuid> command, where uuid is the unique device id shown when you use nmcli conn sh
command.

Note: nmcli connection up <<uuid> command switches ON the networking - despite the config file used.
Alternatively, sudo ifup <device name> also brings the networking up (provided the network interface/device is
configured in the /etc/network/interfaces file).

Since we used the sudo ifdown enp5s0 command above, the connection went down.
Below steps show how to bring the connection back using NetworkManager.

av@Hamsathwani:~$ sudo ifup enp5s0


Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp5s0/5c:f9:dd:3e:78:5b
Sending on LPF/enp5s0/5c:f9:dd:3e:78:5b
Sending on Socket/fallback
DHCPDISCOVER on enp5s0 to 255.255.255.255 port 67 interval 3 (xid=0x1a86ef71)
DHCPOFFER of 192.168.0.33 from 192.168.0.1
DHCPREQUEST for 192.168.0.33 on enp5s0 to 255.255.255.255 port 67 (xid=0x71ef861a)
DHCPACK of 192.168.0.33 from 192.168.0.1 (xid=0x1a86ef71)
bound to 192.168.0.33 -- renewal in 39061 seconds.

The above command brings up the Network connection with the Ethernet device enp5s0, whose MAC address is
5c:f9:dd:3e:78:5b.

av@Hamsathwani:~$ nmcli device show


GENERAL.DEVICE: enp5s0
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 5C:F9:DD:3E:78:5B
GENERAL.MTU: 1500
GENERAL.STATE: 10 (unmanaged)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.0.33/24
IP4.GATEWAY: 192.168.0.1
IP4.ROUTE[1]: dst = 192.168.0.0/24, nh = 0.0.0.0, mt = 0
IP4.ROUTE[2]: dst = 0.0.0.0/0, nh = 192.168.0.1, mt = 0
IP4.ROUTE[3]: dst = 169.254.0.0/16, nh = 0.0.0.0, mt = 1000
IP6.ADDRESS[1]: fe80::5ef9:ddff:fe3e:785b/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 256

GENERAL.DEVICE: lo
GENERAL.TYPE: loopback
GENERAL.HWADDR: 00:00:00:00:00:00
GENERAL.MTU: 65536
GENERAL.STATE: 10 (unmanaged)
GENERAL.CONNECTION: --
GENERAL.CON-PATH: --
IP4.ADDRESS[1]: 127.0.0.1/8
IP4.GATEWAY: --
IP6.ADDRESS[1]: ::1/128
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = ::1/128, nh = ::, mt = 256

Note: Note the difference in the output of the same command nmcli device show above and here. The first time we
used this command after running sudo ifdown enp5s0 command; hence, we get an output which didn’t show any
details on ip address (as the ifdown command had brought the connection down). However, since we used the sudo
ifup enp5s0 this time, it shows the complete connection details (as the ifup command has brought the network up,
now).

Similarly, notice the difference in the output of the below commands also.
Now the ip link show command says that the enp5s0 network interface state is UP; and, the ifconfig command
shows the output for enp5s0 also (with both ipv4 and ipv6 addresses). Also, unlike earlier, the hostname -I command
returns the ip address now.

1. cat /proc/net/dev
2. ls /sys/class/net
3. ip link show
4. ifconfig

av@Hamsathwani:~$ cat /proc/net/dev


Inter-| Receive | Transmit

face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed

lo: 315667 3092 0 0 0 0 0 0 315667 3092 0 0 0 0 0 0

enp5s0: 68216336 86175 0 0 0 0 0 81 12801954 54718 0 0 0 0 1 0

av@Hamsathwani:~$ ls /sys/class/net
enp5s0 lo

av@Hamsathwani:~$ ip link show


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: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group
default qlen 1000
link/ether 5c:f9:dd:3e:78:5b brd ff:ff:ff:ff:ff:ff

av@Hamsathwani:~$ ifconfig
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.33 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::5ef9:ddff:fe3e:785b prefixlen 64 scopeid 0x20<link>
ether 5c:f9:dd:3e:78:5b txqueuelen 1000 (Ethernet)
RX packets 86385 bytes 68229585 (68.2 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 54833 bytes 12809606 (12.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 1 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536


inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3092 bytes 315667 (315.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3092 bytes 315667 (315.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

av@Hamsathwani:~$ hostname -I
192.168.0.33

Alternative command to see the connection / ip address details.


av@Hamsathwani:~$ ip a
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: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen
1000
link/ether 5c:f9:dd:3e:78:5b brd ff:ff:ff:ff:ff:ff
inet 192.168.0.33/24 brd 192.168.0.255 scope global dynamic enp5s0
valid_lft 83785sec preferred_lft 83785sec
inet6 fe80::5ef9:ddff:fe3e:785b/64 scope link
valid_lft forever preferred_lft forever

See link below to know how to switch to /etc/network/interfaces to control/manage network connections.
https://linuxconfig.org/how-to-switch-back-networking-to-etc-network-interfaces-on-ubuntu-20-04-focal-fossa-linux

To know how to change from networkd to NetworkManager, see link:


https://www.cyberciti.biz/faq/change-netplan-renderer-from-networkd-to-networkmanager/

Netplan is a utility for easily configuring networking on a Linux-based system. It supports both networkd and
NetworkManager. networkd is part of Systemd. In other word systemd-networkd used to manage network
connections using Systemd. On the other hand NetworkManager is a GUI tool for configuring networking options.

You can tell Netplan to use NetworkManager and it is useful for Linux desktop or laptop users. By default all network
devices get handled by systemd-networkd.

NetworkManager vs networkd:
Source: https://askubuntu.com/questions/1122757/netplan-vs-networkmanager-on-ubuntu-18-04-and-above

The difference the renderer makes, is the decision to run either systemd-networkd or NetworkManager. This
distinction is identified by a file in /etc/netplan/*.yaml.

networkd is normally used in server installations, where the network environment is fairly static.

NetworkManager is normally used in desktop installations, and was used in all prior versions of Ubuntu.
NetworkManager is easier to use in environments where network requirements change a lot... like in wireless
networking. nmcli/nmtui/etc are NetworkManager commands.
Good reference on networkd:
https://wiki.archlinux.org/title/Systemd-networkd

av@Hamsathwani:~$ resolvectl status


Global
LLMNR setting: no
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
Current DNS Server: 192.168.0.1
DNS Servers: 192.168.0.1
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa
18.172.in-addr.arpa
19.172.in-addr.arpa
20.172.in-addr.arpa
21.172.in-addr.arpa
22.172.in-addr.arpa
23.172.in-addr.arpa
24.172.in-addr.arpa
25.172.in-addr.arpa
26.172.in-addr.arpa
27.172.in-addr.arpa
28.172.in-addr.arpa
29.172.in-addr.arpa
30.172.in-addr.arpa
31.172.in-addr.arpa
corp
d.f.ip6.arpa
home
internal
intranet
lan
local
private
test

Link 2 (enp5s0)
Current Scopes: none
DefaultRoute setting: no
LLMNR setting: yes
MulticastDNS setting: no
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no

# 6: Use netplan to configure network.


https://askubuntu.com/questions/1156990/netplan-config-not-working
https://askubuntu.com/questions/1033628/netplan-configuration-error-invalid-yaml-did-not-find-expected-key

# 7 : How to change renderer from systemd-networkd NetworkManager?


Source: https://www.cyberciti.biz/faq/change-netplan-renderer-from-networkd-to-networkmanager/

Step-1:

First view the config file using the cat command:


cat /etc/netplan/01-netcfg.yaml

Sample outputs:

# This file describes the network interfaces available on your system


# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp0s31f6:
dhcp4: yes
The above config tells of bringing up the Ethernet interface named enp0s31f6 via DHCP.

av@Hamsathwani:~$ cat /etc/netplan/01-netcfg.yaml


network:
version: 2
#renderer: networkd
renderer: NetworkManager
ethernets:
usb0:
dhcp4: true
enp5s0:
dhcp4: true
The above config tells of bringing up the Ethernet interface named enp5s0 via DHCP.

Change the value of renderer: to networkd or NetworkManager, as you wish – to switch between the two.

Similarly, check the below config file also.


cat /etc/netplan/01-network-manager-all.yaml

av@Hamsathwani:~$ cat /etc/netplan/01-network-manager-all.yaml


# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
# renderer: networkd

Again, change the value of renderer: to networkd or NetworkManager, as you wish – to switch between the two.

Note: Make sure, however, that these 2 files’ configuration match always.

Finally, ensure that the NetworkManager is managing the nework. The NetworkManager.conf file should look something
like this.

av@Hamsathwani:~$ cat /etc/NetworkManager/NetworkManager.conf


[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

This managed=false means network-manager will not manage network interfaces defined in
/etc/network/interfaces.

Note also that the NetworkManager is using the plugin: ifupdown (thus, ifup and ifdown commands) to manage the
networks.

Addl. Info:
Source: https://askubuntu.com/questions/653674/is-the-file-etc-network-interfaces-ignored-when-i-use-the-
network-manager

By default ifup/ifdown configures network interfaces based on interface definitions from /etc/network/interface
file.

network-manager can read and configure interfaces reading this file, using a plugin named ifupdown.

You might see a line like in /etc/NetworkManager/NetworkManager.conf file's main configuration snippet :

plugins=ifupdown,keyfile,ofono

these are the plugins in use.

Next in the /etc/NetworkManager/NetworkManager.conf file you should have :

[ifupdown]
managed=false

This managed=false means network-manager will not manage network interfaces defined in
/etc/network/interfaces.
To solve your problem you need to make it true so that the /etc/network/interfaces file is parsed by network-
manager and hence the relevant interface(s) will be configured accordingly :

[ifupdown]
managed=true

On a different note, if you have interface(s) defined in /etc/network/interfaces and not using network-manager
for any other interfaces then you should better consider these two options :

Let ifup/ifdown manages the interface(s) (you can uninstall network-manager if you want in this case)

Configure interface(s) directly using network-manager.

Step-2: Network Manager as the backend for netplan

Network Manager strives for Network Connectivity, which “Just Works” for new Linux users. The machine should use
the wired network connection when it’s plugged in but automatically switch to a wireless connection when the user
unplugs it. Similarly, you can easily configure a VPN network and many other options. Edit the config file using a text
editor such as nano command or vim command.

Note: This step is only required if you have multiple .yaml files in the path. If you have only this file:
/etc/netplan/01-network-manager-all.yaml in the path, then, directly create the 01-netcfg.yaml file. This step
is not required.

In fact, you can delete existing netplan config file 01-netcfg.yaml (if any) & use the below command to auto-
generate it. Then, modify the contents as required. Usually the auto-generated file creates only the renderer config.

sudo cp -v /etc/netplan/01-netcfg.yaml /root/


sudo vim /etc/netplan/01-netcfg.yaml

Update it as follows:

# This file describes the network interfaces available on your system


# For more information, see netplan(5).
# Set and change netplan renderer to NetworkManager GUI tool
network:
version: 2
renderer: NetworkManager
# renderer: network
ethernets:
usb0:
dhcp4: true
enp5s0:
dhcp4: true
# wifi:
# iwlwifi:
# dhcp4: true

Note: Proper indentation is a must for .yaml files & tabs are not allowed (only spaces are allowed).

Note: The above configuration is for NetworkManager as the renderer (i.e. network will be managed by
NetworkManager. If you want networkd to manage the network connections, use the commented line, instead.

Note: Similarly, the above config shows only the configuration for Ethernet connections. For wifi connections, you
need to add the wifi part too (commented in the above file).

Save and close the file. You can reboot the Linux computer or apply change by typing the following command:

sudo netplan apply

The above command applies the current netplan configuration to a running system.
Step-3: How do I use a GUI tool to configure networking?

Open Activities (Press Super key) -> Settings -> Network.

Now you can edit or and set new IP address. Select IPv4 or IPv6. Type in the IP Address and Gateway, as well as the
appropriate Netmask. In the DNS section, switch the Automatic switch to off. Enter the IP address of a custom DNS
server (i.e. changing the default DNS Server) you want to use and so on:

####################

Note: Installed speedtest and traceroute (see File: System Config & System Commands Exec History (starting Feb 19,
2022).docx). Installed traceroute in order to troubleshoot(trace the packet route), as speedtest was giving errors.
Connection used: ACT Fibernet (75MBps)
The Network Interface was configured both in /etc/network/interfaces file, and netplan was also installed (as seen
below). May be, this is the issue.

av@Hamsathwani:~$ date
Sunday 20 February 2022 10:44:20 AM IST

av@Hamsathwani:~$ nmcli connection show


NAME UUID TYPE DEVICE
ACTFibernet-LAN dee9cb16-cb1f-4db0-acbd-09724f45ab8d ethernet --
MobileData-USBTethering 6117a625-0e10-4dd9-b210-a3d83f43ad5a ethernet --
netplan-enp5s0 e1419a5e-5e1d-3fff-a17c-b2fc6d2cef99 ethernet --
netplan-usb0 ea8e372f-c04d-3e0a-bd69-2a2e82cd1c26 ethernet --
Wi-Fi connection 1 cd46d8a9-799a-4beb-bad3-c18578fca94c wifi --

(To see the routing table):


av@Hamsathwani:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 enp5s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp5s0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp5s0

(To see the packets trace route):


av@Hamsathwani:~$ traceroute www.google.com
traceroute to www.google.com (142.250.77.164), 64 hops max
1 192.168.0.1 0.504ms 0.375ms 0.409ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * traceroute: sendto: Network is unreachable

Note: Uninstalled ifupdown utility to see if the network still works only with nmcli utility. Found that it is workng
fine. So, either ifupdown or nmcli commands can be used to start/stop/manage the network related stuff.

av@Hamsathwani:~$ date
Sunday 20 February 2022 10:44:20 AM IST

av@Hamsathwani:~$ sudo apt-get remove ifupdown


Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
ifupdown pppoeconf
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 370 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 259592 files and directories currently installed.)
Removing pppoeconf (1.21ubuntu1) ...
Removing ifupdown (0.8.35ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...

#################

# 8: How to enable, start, stop, check status of Network Manager?


Source: https://askubuntu.com/questions/1276402/what-can-i-do-to-get-network-manager-working-on-20-04

this is the commands that enabling or disabling network manager:

sudo service network-manager start - starting network-manager.


sudo service network-manager stop - stops network manager.
sudo service network-manager restart - restarts network manager.

i recommend using the restart command to re-active the network-manager.

you can also try the following commands:

sudo /etc/init.d/networking stop - to stop networking.service.


sudo /etc/init.d/networking start - to start networking.service.
sudo /etc/init.d/networking restart - to restart networking.service.

please try this commands out and see if the problem fixed.

please use this two commands for networking status and post it on comments:

sudo systemctl status network-manager.service


ifconfig

#############

# 9: How to enable networking if netplan is uninstalled/removed accidentally?


(Alternate ways to manage network)
Source: https://askubuntu.com/questions/1298255/connecting-ubuntu-20-04-to-ethernet-without-netplan

If the command ifconfig still works, you can run


sudo ifconfig <interface> up
to bring up the Ethernet. Then run
dhclient <interface>

to renew a IP address for the Ethernet.

As for the packages that got removed, run


grep "remove " /var/log/dpkg.log

to show what was recently removed to help reinstall what is missing.

###############

Note: Found the below entries in the var/log/ufw.log file.


Too many pings from Source: local sever (192.168.0.1) to the Destination: 224.0.0.1 (seems it is ACT Fibernet’s Nokia
Router multicast address – ref. links given)

Need to check if there are any implications or side-effects (as the destination address was of ACT Fibernet’s Nokia
Router’s).

Source: https://askubuntu.com/questions/278964/what-could-be-the-cause-for-these-strange-ufw-block-entries-in-
my-syslog
https://unix.stackexchange.com/questions/71613/how-can-i-disable-ufw-logging-for-a-specific-event
https://www.searchnetworking.de/forum/messages.cfm?threadid=39135782-2F85-4EC9-9FE07BF91E077A69 (Didn’t
open it, due to security risk warning).

Base on this answer from ServerFault,

ufw supports per rule logging. By default, no logging is performed when a packet matches a rule.

All you have to do is create a UFW deny rule to match those multicast packets.
sudo ufw deny from 192.168.178.1 to 224.0.0.1

ams@hamsathwani:~$ date
Friday 25 March 2022 07:21:44 PM IST

ams@hamsathwani:~$ sudo ufw deny from 192.168.178.1 to 224.0.0.1


Rule added

################

You might also like