Tuesday, July 7, 2020

Check which linux kernel module is loaded

To check what modules are currently being loaded in kernel, you can just use lsmod command

$ lsmod 

The output will look like below


To get more information about a particular module, you can use modinfo. Lets say we want to get more information about psmouse module
$ modinfo psmouse

The output will look like below














Saturday, June 27, 2020

Testing mysql database connection using php mysqli

Sometimes you do not have mysql client in your web server to test mysql connection to database server. Using this method, you can use php, which will be available in all php based web server, to test your connection. This method is very easy to implement, just one line to do the testing. Thank you to Mr Guus for this awesome method

We are going to use var_dump with mysqli_connect functions, available in php.

$ php -r 'var_dump(mysqli_connect("10.0.0.10", "myuser", "mypassword", "mydatabase"));'

whereby 10.0.0.10 is my database ip address, myuser is my database username, mypassword is my database password, and mydatabase is the name of my database. Php -r is an option to run php command without the script tags

If the command does not throw any error, then your database connection is good to go.

Friday, May 8, 2020

Update DNS Server Information on Linux CentOS 7

To update the DNS server that the operating system will refer to, please follow below easy steps

1. Edit /etc/resolv.conf. In this example I use nano text editor. If you do not have nano, you can install it by running "yum install nano -y"
# nano /etc/resolv.conf

2. Type in "nameserver" followed by a space, and followed by your DNS server ip address. Please remember that the sequence of the entry is important. So please put your primary DNS server on top of your secondary server in the /etc/resolv.conf. In this example, my primary DNS is 192.168.1.1 and my secondary DNS is 192.168.1.2
nameserver 192.168.1.1
nameserver 192.168.1.2

3. Save and exit. For nano, you can simply press Ctrl-x, y and Enter.

4. Check if you have added the configuration correctly
# cat /etc/resolv.conf
nameserver 192.168.1.1
nameserver 192.168.1.2 

Thursday, May 7, 2020

Update Proxmox Network Configuration Without Restarting

In proxmox 6.1-7, if you make any changes to network configuration using the web interface, you either have to reboot the box, or press the "Apply Configuration" button to apply the changes. But the "Apply Configuration" button needs a package named ifupdown2 from proxmox repository to operate correctly.

So in order to make the button usable, so that we do not have to reboot the box every time we change proxmox network configuration, please follow below simple steps

1. Enable pve no-subscription repository, and disable proxmox default enterprise repository by referring here

2. Update proxmox package information
# apt update

3. Install ifupdown2
# apt install ifupdown2 -y

4. Now you can change any network settings in the proxmox web ui, and apply the configuration by pressing "Apply Configuration" button like below


Wednesday, May 6, 2020

Using Openvpn Client in Alpine Linux

Installing openvpn client in alpine linux is very easy. Just follow below command

# apk add openvpn

To use it, just run the command against an openvpn configuration file
# openvpn myopenvpnconfig.file

The first time you are using openvpn client, you will probably get this error:
ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)

What you can do is just give 666 permission to /dev/net/tun
# chmod 666 /dev/net/tun

and rerun the openvpn command
# openvpn myopenvpnconfig.file

Once you get this message "Initialization Sequence Completed", you should be able to access your remote server