How Do You Get a NIC on a Linux Server to Work?

Problem scenario
Your NIC on your Fedora Linux server totally will not work. The physical NIC has no lights on it. It seems it is disabled. You cannot enable it with commands.

You see errors like these in logs: "NetworkManager.service: Start request repeated too quickly."

What should you do?

Solution
Run this command:

journalctl -u NetworkManager

Do you see lines like these?

Jan 25 20:47:00 localhost.localdomain systemd[1]: NetworkManager.service: Scheduled restart job, restart counter is at 5.
Jan 25 20:47:00 localhost.localdomain systemd[1]: Stopped Network Manager.
Jan 25 20:47:00 localhost.localdomain systemd[1]: NetworkManager.service: Start request repeated too quickly.
Jan 25 20:47:00 localhost.localdomain systemd[1]: NetworkManager.service: Failed with result 'exit-code'.
Jan 25 20:47:00 localhost.localdomain systemd[1]: Failed to start Network Manager.
lines 5443-5479/5479 (END)

Look for a line like this (and it may be subtle in the logs in gray text):

Jan 25 20:47:00 localhost.localdomain NetworkManager[3454]: /usr/sbin/NetworkManager: error while loading shared libraries: foobar.so.4: cannot open shared object file>

Try to find the foobar.so.4 file (e.g., with sudo find / -name foobar.so.4). It could be a lib.so file. Have the permissions changed? Was the file deleted? You may need to run sudo chmod u+r,g+x foobar.so.4 to get it to be executable.

A downside to color-coded logs is that sometimes they bring your attention to irrelevant details and contribute to you overlooking important details.

How Is Training Different from Exercise?

Problem scenario
You work out regularly at a fitness gym. Is exercise the same as training?

Answer
Exercise is physical activity. Training involves a long-term goal designed to achieve results that will include regular physical activity. Training would include progressively more weights for specific lifts and/or cardio that is increasingly intense or longer in duration.

Source: Starting Strength page 292.

How Do You Get a NIC to Permanently Be in a firewalld Zone with a Single Command?

Problem scenario
A NIC or network interface is not being protected by a zone in the firewalld. You run firewall-cmd commands, and later run "firewall-cmd --runtime-to-permanent" afterward. But a NIC (e.g., a virtual NIC) will not persistently remain in a zone. You want your firewall-cmd commands to have a permanent effect. The "firewall-cmd --runtime-to-permanent" command is supposed to work, but it is not helping. What should you do?

Solution
Run the individual firewall-cmd commands with the "--perm" flag. We don't know why the "firewall-cmd --runtime-to-permanent" command does not always work.

See also How Do You Get a NIC to Permanently Be in a firewalld Zone with Multiple Commands?

How Do You Get a NIC to Permanently Be in a firewalld Zone with Multiple Commands?

Problem scenario
A NIC or network interface is not being protected by a zone in the firewalld. You run firewall-cmd commands with different flags, but some NIC (e.g., a virtual NIC) will not persistently remain in a zone. You want your firewall-cmd commands to have a permanent effect. The --permanent flag is supposed to work, but it is not helping. What should you do?

Solution
If a firewall-cmd command fails with a --permanent flag, do this as the workaround: 1) reboot so you know there are no temporary (or intended as temporary) firewall changes in memory or in effect. 2) run the firewall-cmd command without the --permanent flag. 3) run this: firewall-cmd --runtime-to-permanent

Runtime configuration is temporary configuration. The changes can be applied to the kernel with the --runtime-to-permanent flag. To read more, see this https://firewalld.org/documentation/configuration/runtime-versus-permanent.html.

The above solution involves successive commands. If you just want to run one Linux command, see also How Do You Get a NIC to Permanently Be in a firewalld Zone with a Single Command?

Should You Disable WPS on Your WiFi/Router at Home?

Problem scenario
You want to not broadcast your home's network (e.g., to make sure people do not borrow your bandwidth or hack your devices such as your thermostat with ransomware). You want to keep using your WiFi. You try to disable the "Broadcast Network Name (SSID)", but you get a prompt like "WARNING:
Disabling Broadcast Network Name (SSID) will disable Wi-Fi Protected Setup (WPS) functionality. Are you sure you want to change?"

Should you click "OK"?

Solution
Yes, click "OK".

It is recommended to disable "Wi-Fi Protected Setup" or "WPS" to harden your network according to https://www.digitalcitizen.life/simple-questions-what-wps-wi-fi-protected-setup/.

How Do You Troubleshoot an IP Address That You Can SSH to, But You Cannot Ping It?

Problem scenario
nmap shows that the host seems down. You cannot ping the IP address. But you can SSH to the IP address. How is this possible?

Solution
Possible Solution #1

A host server could have multiple IP addresses (e.g., with a virtual server hosted by a type 2 hypervisor utilizing KVM or QEMU). The networking could be done at the kernel level.

It's not the ssh client that decides through which interface TCP packets should go, it's the kernel. In short, SSH asks the kernel to open a connection to a certain IP address, and the kernel decides which interface is to be used by consulting the routing tables.

https://unix.stackexchange.com/questions/16057/use-ssh-with-a-specific-network-interface

Is the client related to the destination server via a type 2 hypervisor?

Possible Solution #2
Check the firewall rules. icmp packets could be dropped, but SSH could still be allowed. See this external posting for more information.

Possible Solution #3
Restart the firewall service or reboot. You may want to see this external posting for more information.

Possible Solution #4
If you searched online, you may want to read more about SSH with other postings on this site.

How Do You Write a Python Program to Extract Lines of a Specific Date?

Problem scenario:
You have a log like this:

Sep 18 07:28:11 server1 sshd[29284]: Received disconnect from 125.52.17.109 port 46970:11: Bye Bye [preauth]
Sep 18 07:28:11 server1 sshd[29284]: Disconnected from 125.52.17.109 port 46970 [preauth]
Sep 18 07:28:11 server1 sshd[29282]: Failed password for root from 51.12.19.109 port 24844 ssh2
Sep 18 07:28:13 server1 sshd[29287]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=119.29.155.214  user=root
Sep 18 07:28:13 server1 sshd[29282]: Failed password for root from 51.12.19.109 port 24844 ssh2
Sep 18 07:28:14 server1 sshd[29282]: Received disconnect from 51.12.19.109 port 24844:11:  [preauth]
Sep 18 07:28:14 server1 sshd[29282]: Disconnected from 51.12.19.109 port 24844 [preauth]
Sep 18 07:28:14 server1 sshd[29282]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=51.12.19.109  user=root
Sep 18 07:28:15 server1 sudo:     jdoe : TTY=pts/0 ; PWD=/home/jdoe/ ; USER=root ; COMMAND=/usr/bin/tail /var/log/auth.log
Sep 18 07:28:15 server1 sudo: pam_unix(sudo:session): session opened for user root by jdoe(uid=0)

You want to extract lines that happen on a specific day using Python with only four lines of code. You do not want to use an "import" statement. What do you do?

Solution
Here is how to extract the "Jun 17" days:

log_reader = open('auth.log', 'r')
for line in log_reader:
    if line.startswith("Jun 15"):
        print(line)

This solution assumes the text log starts with the day in the format provided; it is an example, and your logs may require a different solution.

What is MEV?

Question
What does MEV stand for in the context of cryptocurrency?

Answer
MEV means Maximal Extractable Value; it used to mean "Miner Extractable Value" according to Coindesk.com. Cryptocurrency miners solve problems and receive a reward for doing so.

If a miner is able to successfully add a block to the blockchain, they will receive … bitcoins as a reward.

https://www.bankrate.com/investing/what-is-bitcoin-mining/#how

Maximal extractable value (MEV) refers to the maximum value that can be extracted from block production in excess of the standard block reward and gas fees by including, excluding, and changing the order of transactions in a block.

https://ethereum.org/en/developers/docs/mev/

The value that miners can obtain from changing the sequence of transactions inside the blocks they generate is known as the miner extractable value (MEV).

https://cointelegraph.com/learn/what-is-mev-ethereums-invisible-tax

What is Bor in Cryptocurrency?

Question
In the context of cryptocurrency, what is Bor?

Solution

It is the way to use MATIC with the Go programming language.

Bor is the Official Golang implementation of the Matic protocol. It is a fork of Go Ethereum - https://github.com/ethereum/go-ethereum and EVM compatible.

https://github.com/maticnetwork/bor