c++ – Configure virtual USB drive, quickly copy the images/files from a Virtual USB disc/drive which are saved by a passive device

I have project to work with a camera which is design to capture color images in front view and back n white images from side angles. In this case, camera device has 2 cameras
Front camera is a UVC camera which capture color images. other camera is capturing 2 black and white images for the same capture
Color camera is directly connected to the image analyzing system which is running a UVC driver and the item recognizing application.
Black and White image capturing camera is connected to the analyzing system via an OTG cable. These 2 camera integrated unit is a single device which has a Type C USB output port and general USB 2/3 port.
if we directly plug a flash drive to the unit, black and white images directly saved to the flash drive. that is the method they provided to transfer the image files from the camera unit. I need to receive all the images to my analyzing system to compare. So I created a virtual USB driver using the USB-OTG concepts described in “https://unix.stackexchange.com/questions/120368/make-a-computer-act-as-a-virtual-usb-device-for-other-equipments” post.
so, I’m using a Raspberry Pi/Jetson-nano system as the analyzing computer and photo recognizing application is running in the system.
enter image description here

In this case, my verification application is receiving color images via USB cable. with the event, I’m receiving the image file names for the relevant other 2 black and white images. black and white images are directly saving to the Virtual USB disc prepared in the Raspberry Pi Unit.

without running the application, I can see all the black and white images inside the virtual USB device. I wrote following code to retrieve/copy the images from virtual USB device (Mass storage of the camera unit).

I used following program to receive the images.

#include <iostream>
#include <fstream>
#include <vector>
#include <memory>
#include <cstdio>
#include <unistd.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>

#include "device_manager.h"

#include "cc_camera_camera_manager_client.h"
#include "cc_camera_camera_client.h"
#include "camera_enums.h"

using namespace std;
using namespace cc_camera;

int MassStorageOperation(cc_camera::camera_sdk::ImageEventMetaData md);
int CopyBlackAndWhiteImages(cc_camera::camera_sdk::ImageEventMetaData md);
int AccessStorage();
void ToggleStorage(std::string src_mount_device, std::string target_mount_point, int inter_operation_delay);


class AttachedEventObserver: public DeviceAttachedListener
{
public:
    void Attached(DeviceInfo info) override
    {
        printf("--- %s: vid/pid %0x:%0x bus/addr %0x:%0x %sn",
                __func__,
                info.vid, info.pid,
                info.bus_number, info.device_address,
                info.serial_number.c_str());
    }
};

class DetachedEventObserver: public DeviceDetachedListener
{
public:
    void Detached(DeviceInfo info) override
    {
        printf("--- %s: vid/pid %0x:%0x bus/addr %0x:%0x %sn",
                __func__,
                info.vid, info.pid,
                info.bus_number, info.device_address,
                info.serial_number.c_str());
    }
};


class DecodeImageEventObserver: public cc_camera::camera_sdk::DecodeImageEventListener
{
private:
    cc_camera::camera_sdk::ImageEventMetaData first_image_meta_data;
    bool very_first_decode;
    int decode_count;
public: 
    DecodeImageEventObserver()
    {
        very_first_decode = true;
        decode_count = 0;
    }
    void ImageReceived(cc_camera::camera_sdk::ImageEventData image_data, cc_camera::camera_sdk::ImageEventMetaData md)
    {
        printf("-- DecodeImageEventObserver: Image event received... count:%dn", decode_count);
        printf("--- Image number: %d", md.image_number);
        printf(" - Decode_data: %sn", md.decode_data.c_str());
        
        usleep(750*1000);
        MassStorageOperation(md);

    }
};

int AccessStorage()
{
    std::string src_storage_device = "/dev/sbcblk0p15";
    std::string dest_mount_point = "/media/cc_camera/VUSB_FLASH";
    std::string cc_camera_decode_dir = "cc_camera_DecodeImages";
    
    int status = 0;    
    bool is_mounted = false;
    
    status = umount2(src_storage_device.c_str(), MNT_FORCE);
    
    if(status == 0)
    {
        printf("--- Storage un-mounted...n");
    }
    else
    {
        printf("-*** umount failed: source storage: %s - destination mount point: %s - failure: (%d)(%s)n", 
                            src_storage_device.c_str(), dest_mount_point.c_str(), errno, strerror(errno));
        return errno;
    }
    
    
    status = mount(src_storage_device.c_str(), dest_mount_point.c_str(), "vfat", 0, "");
    if(status == 0)
    {
        usleep(100*1000);
        status = mount(src_storage_device.c_str(), dest_mount_point.c_str(), "vfat", 0, "");
        is_mounted = true;
        printf("--- Storage mounted...n");        
                
    }
    else
    {
        printf("-*** Mount failed: source storage: %s - destination mount point: %s - failure: (%d)(%s)n", 
                            src_storage_device.c_str(), dest_mount_point.c_str(), errno, strerror(errno));
        return errno;
    }
    
    status = umount2(src_storage_device.c_str(), MNT_FORCE);
    
    if(status != 0)
    {
        is_mounted = true;
        printf("----- Storage un-mounted...n");
    }
    else
    {
        printf("-***** umount failed: source storage: %s - destination mount point: %s - failure: (%d)(%s)n", 
                            src_storage_device.c_str(), dest_mount_point.c_str(), errno, strerror(errno));
        return errno;
    }
    
    return status;
}

int MountStorage(std::string src_mount_device, std::string target_mount_point)
{
    int status = 0;    
    bool is_mounted = false;
    int retry_count = 0;
    std::string unmount_command = "umount -l " + src_mount_device;
    
    status = mount(src_mount_device.c_str(), target_mount_point.c_str(), "vfat", 0, "");
    if(status == 0)
    {
        printf("--- Storage mounted...n");
        is_mounted = true;                  
    }
    else
    {
        printf("- *** Mount failed: source storage: %s - destination mount point: %s - failure: (%d)(%s)n", 
                            src_mount_device.c_str(), target_mount_point.c_str(), errno, strerror(errno));
                                
        status = system(unmount_command.c_str());
        if(status == 0)
        {
            printf("--- system:Storage un-mounted...n");
        }
        else if(status < 0 && errno != EINVAL)
        {
            printf("-*** system:umount failed: unmount_command: %s - failure: (%d)(%s)n", 
                                unmount_command.c_str(), errno, strerror(errno));
        }
        
        retry_count = 20;
        while( retry_count > 0) {
            usleep(100*1000);
            status = mount(src_mount_device.c_str(), target_mount_point.c_str(), "vfat", 0, "");
            if(status == 0)
            {
                printf("--- Storage mounted after retry...n");
                is_mounted = true;             
                
                break;
                
            } else {
                printf("- *** Mount failed: retry count=%d, source storage: %s - destination mount point: %s - failure: (%d)(%s)n", 
                            retry_count, src_mount_device.c_str(), target_mount_point.c_str(), errno, strerror(errno));
            }
            retry_count--;
        }
       
       if(!is_mounted){
            return errno;
        }
    }
    
    return 0;
}

int UmountStorage(std::string src_mount_device)
{
    int status = 0;    
    bool is_mounted = false;
    int retry_count = 0;
    std::string unmount_command = "umount -l " + src_mount_device;
    
    status = system(unmount_command.c_str());
    if(status == 0)
    {
        is_mounted = false;
        printf("--- system:Storage un-mounted...n");
    }
    else if(status < 0 && errno != EINVAL)
    {
        printf("-*** system:umount failed: unmount_command: %s - failure: (%d)(%s)n", 
                            unmount_command.c_str(), errno, strerror(errno));
                                
        retry_count = 30;
        while( retry_count > 0) {
            usleep(200*1000);
            status = system(unmount_command.c_str());
            if(status == 0)
            {
                printf("--- system:Storage un-mounted after retry...n");
                is_mounted = false;             
                
                break;
                
            }
            retry_count--;
        }
        //return errno;
    } else if (errno == EINVAL)
    {
        printf("-*** system:umount failed: unmount_command: %s - failure: (%d)(%s)n", 
                            unmount_command.c_str(), errno, strerror(errno));
                            
    }
    
    
    /**
     * int mount(const char *source, const char *target,
     *              const char *filesystemtype, 
     *              unsigned long mountflags,
     *              const void *data);
     */
    
    
    status = umount2(src_mount_device.c_str(), MNT_DETACH);
    if(status != 0)
    {
        is_mounted = true;
        printf("--- Storage un-mounted...n");
    }
    else
    {
        printf("-*** umount failed: source storage: %s - failure: (%d)(%s)n", 
                            src_mount_device.c_str(), errno, strerror(errno));
        
        retry_count = 5;
        while( retry_count > 0) {
            usleep(100*1000);
            status = umount2(src_mount_device.c_str(), MNT_FORCE);
            if(status == 0)
            {
                printf("--- Storage un-mounted after retry...n");
                is_mounted = true;             
                
                break;
                
            }
            retry_count--;
        }
        
        return errno;
    }
    
}



int MassStorageOperation(cc_camera::camera_sdk::ImageEventMetaData md)
{
    std::string target_mount_point = "/media/user/VFLASH";
    std::string src_mount_device = "/dev/sdablk0p15";
    std::string image_dir = "BW_Images";
    
    int status = 0;    
    bool is_mounted = false;
    int retry_count = 0;
         
    
    // Unmount the storage
    status = UmountStorage(src_mount_device);
    
    /// Let MP7 to finish trasferring image data.
    usleep(250*1000); 
    
    // Then mount the storage
    status = MountStorage(src_mount_device, target_mount_point);
    
    
    /// now successfully mounted///
    CopyBlackAndWhiteImages(md);
        
    
    printf("--- Storage access completed...n");
    return true;
}

void ToggleStorage(std::string src_mount_device, std::string target_mount_point, int inter_operation_delay)
{
    for(int x=0; x<6; x++) {
        UmountStorage(src_mount_device);
        usleep(inter_operation_delay*1000);
        MountStorage(src_mount_device, target_mount_point);
    }
}

int CopyBlackAndWhiteImages(cc_camera::camera_sdk::ImageEventMetaData md)
{   
    std::string target_mount_point = "/media/cc_camera/MP7FLASH";
    std::string src_mount_device = "/dev/mmcblk0p15";
    std::string image_dir = "cc_camera_DecodeImages";
    
    std::string dest_dir = "./";    
    std::string image_extension = ".jpg";
    std::string bw_image2_path = target_mount_point + "/" + image_dir + "/" + md.decode_data + "_T" + image_extension;    
    std::string bw_image2_path_local = "./" + md.decode_data + image_extension;
    std::string bw_image1_path = target_mount_point + "/" + image_dir + "/" + md.decode_data + "_P" + image_extension;
    std::string bw_image1_path_local = "./" + md.decode_data + image_extension;
    
    printf("--- BW iamge 2: %sn--- BW iamge 1: %sn", bw_image2_path.c_str(), bw_image1_path.c_str());
    
    FILE *image_original_t, *image_copy_t, *image_original_p, *image_copy_p;

    
    // copy tower image
    ToggleStorage(src_mount_device, target_mount_point, 1);
    if(access(bw_image2_path.c_str(), F_OK) != 0)
    {
        /// refresh the storage
        int retry_count = 5;
        while(retry_count > 0 && access(bw_image2_path.c_str(), F_OK) != 0){
            printf("---*BW iamge 2 not ready n");          
            UmountStorage(src_mount_device);
            usleep(250*1000);
            MountStorage(src_mount_device, target_mount_point);
            retry_count--;
        }
    }
    
    if(access(bw_image2_path.c_str(), F_OK) == 0)
    {
        printf("---- BW iamge 2 is availablen");
        
        image_original_t = fopen(bw_image2_path.c_str(), "rb");       
        if(image_original_t == NULL)
        {
            printf("-*** BW iamge 2: Error opening file - ");
            printf("failure: (%d)(%s)n", errno, strerror(errno));
        }

        image_copy_t = fopen(bw_image2_path_local.c_str(), "wb");
        if(image_copy_t == NULL)
        {
            printf("-*** Local BW iamge 2: Error opening file - ");
            printf("failure: (%d)(%s)n", errno, strerror(errno));
        }

        struct stat file_stat;
        int read_point = 0;
                
        if(!image_original_t || !image_copy_t)
        {
            printf("--- File Error...n");
        } else {
            long file_size;
            fseek(image_original_t, 0, SEEK_END);
            file_size = ftell(image_original_t);
            rewind(image_original_t);
            unsigned char *file_buffer = (unsigned char *)malloc(sizeof(unsigned char) * file_size);
            if(NULL == file_buffer)
            {
                printf("--- Memory errorn");
            }
            printf("---- file size: %dn", file_size);


            size_t result = fread(file_buffer, 1, file_size, image_original_t);
            
            result = fwrite(file_buffer, sizeof(unsigned char), file_size, image_copy_t);
            
            free(file_buffer);
            
            fclose(image_original_t);
            fclose(image_copy_t);
        }
    } else
    {
        printf("---- BW iamge 2 is not OKn");
    }
    
    /// Copy platter image      
    ToggleStorage(src_mount_device, target_mount_point, 1);
        
    if(access(bw_image1_path.c_str(), F_OK) != 0)
    {
        int retry_count = 5;
        while(retry_count > 0 && access(bw_image1_path.c_str(), F_OK) != 0){
            printf("---*BW iamge 1 image not ready n");            
            UmountStorage(src_mount_device);
            usleep(250*1000);
            MountStorage(src_mount_device, target_mount_point);
            retry_count--;
        }
    }
    
    if(access(bw_image1_path.c_str(), F_OK) == 0)
    {
        printf("---- BW iamge 1 is availablen");
        
        image_original_p = fopen(bw_image1_path.c_str(), "r");
        if(image_original_p == NULL)
        {
            printf("-*** BW iamge 1: Error opening file - ");
            printf("failure: (%d)(%s)n", errno, strerror(errno));
        }
        
        image_copy_p = fopen(bw_image1_path_local.c_str(), "w");
        if(image_copy_p == NULL)
        {
            printf("-*** BW iamge 1: Error opening file - ");
            printf("failure: (%d)(%s)n", errno, strerror(errno));
        }

        if(!image_original_p || !image_copy_p)
        {
            printf("--- File Error...n");
        } else {
            
            struct stat file_stat;
            int read_point = 0;
                    
            if(!image_original_p || !image_copy_p)
            {
                printf("--- File Error...n");
            } else {
                
                long file_size;
                fseek(image_original_p, 0, SEEK_END);
                file_size = ftell(image_original_p);
                rewind(image_original_p);
                unsigned char *file_buffer = (unsigned char *)malloc(sizeof(unsigned char) * file_size);
                if(NULL == file_buffer)
                {
                    printf("--- Memory errorn");
                }
                printf("---- file size: %dn", file_size);


                size_t result = fread(file_buffer, 1, file_size, image_original_p);
                
                result = fwrite(file_buffer, sizeof(unsigned char), file_size, image_copy_p);
                
                free(file_buffer);
                
                fclose(image_original_p);
                fclose(image_copy_p);
            }

        }
    } else
    {
        printf("---- BW iamge 1 is not OKn");
    }    

    printf("--- File operations completed...n");
}

int main() {

    cout << "------------------------------------------------------------------------" << endl;
        cout << "---- Ticket switching : copy black and white images to local storage----" << endl;
        cout << "---- Press any key and Enter to exit------------------------------------" << endl;
        cout << "------------------------------------------------------------------------" << endl;

    int i;

    DeviceManager device_mgr;

    auto devinfolist = device_mgr.EnumerateDevices();


    for (auto info: devinfolist)
    {
        printf("---- Device info: vid/pid %0x:%0x bus/addr %0x:%0x %sn",
                info.vid, info.pid,
                info.bus_number, info.device_address,
                info.serial_number.c_str());
    }

    cout << "---- Number of connected cameras = " << devinfolist.size() << endl;

    if (0 == devinfolist.size())
    {
        exit(0);
    }

        cc_camera::DeviceManager device_manager;
    std::unique_ptr<cc_camera::camera_sdk::cc_cameraCameraManagerClient> cammgr = cc_camera::camera_sdk::Createcc_cameraCameraManagerClient();

    cout << "---- Constructed: camera manager client" << endl;
    //cin >> i;
        
        AttachedEventObserver attach_event_observer;
        DetachedEventObserver dettach_event_observer;
        device_manager.AddDeviceAttachedListener(attach_event_observer);
        device_manager.AddDeviceDetachedListener(dettach_event_observer);

    std::shared_ptr<cc_camera::camera_sdk::cc_cameraCameraClient> camera = cammgr->Createcc_cameraCamera(devinfolist(0));

    cout << "---- Constructed: camera client" << endl;
    usleep(100*1000);
        
        // register for image events
        ProduceImageEventObserver produce_image_event_observer;
        DecodeImageEventObserver decode_event_observer;
                
        camera->AddProduceImageEventListener(produce_image_event_observer);
        camera->AddDecodeImageEventListener(decode_event_observer);
        
        // block here for user input to exit.
        cin >> i;
        cout << "-----------Program interrupted-----------------------------------------" << endl;
        
        camera->RemoveProduceImageEventListener(produce_image_event_observer);
        camera->RemoveDecodeImageEventListener(decode_event_observer);
        device_manager.RemoveDeviceAttachedListener(attach_event_observer);
        device_manager.RemoveDeviceDetachedListener(dettach_event_observer); 
        
        cout << "------------------------------------------------------------------------" << endl;
                
    return 0;
}

With this approach, I have to use several delays (usleeps()) and multiple mass storage unmout-mount operations. Otherwise, the images saving to mass storage is getting corrupted.

Is this approach correct ? I couldn’t find out better solutions.

If I move from shared hosting to VPS hosting, but my email box will stay local would I still need to massively configure email DNS records?

I currently host a MediaWiki website on a shared CentOS, Apache, MySQL, PHP environment.

I was thinking that sometime in the future I might migrate the website database, filetree and email hosting to a generally non managed VPS hosting (such as Linode, DigitalOcean), because such hostings tend to cost less and be faster, but, for sure I wouldn’t want to start doing crazy email DNS record configurations also.

Assuming that I change my current shared website hosting to a VPS hosting, but my email box will stay local,
(i.e. I wouldn’t send contact-form emails to my Gmail email account, rather, to a local Postfix-Dovecote-Roundcube(?) email account),
In such case, would I still need to massively configure email DNS records, as I would have to do if I did want to transfer contact-form emails to my Gmail email account?

linux networking – How to configure a hypervisor such that a KVM/QEMU virtual machine can reach hosts connected to the same trunk bridge?

1 Problem

My goal is that all LAN traffic is routed through a virtual machine (VM) acting as a router and firewall. Other VMs on the same hypervisor should also be routed through the firewall VM. See the following network sketch. Physical hosts connected to the trunk bridge can ping each other successfully, but VMs could not be reached yet.

2 Details

Network configuration on the hypervisor:

# =======
# Bridges
# =======
# ---------------------
# VLAN bridge br-vlan-3
# ---------------------
ip link add name br-vlan-3 type bridge
ip addr add 10.66.3.11/24 dev br-vlan-3
ip link set dev br-vlan-3 up

# ---------------------
# Trunk bridge Upstream
# ---------------------
ip link add name br-trunk-up type bridge vlan_filtering 1 vlan_default_pvid 0
ip link set br-trunk-up up

# ---------------
# Trunk bridge VM
# ---------------
ip link add name br-trunk-vm type bridge vlan_filtering 1 vlan_default_pvid 0
ip link set br-trunk-vm up

# =====
# Hosts
# =====

# Set physical devices up
ip link set enp5s0 up
ip link set enp9s0f0 up
ip link set enp9s0f1 up
ip link set enp9s0f2 up
ip link set enp9s0f3 up


# ----------------------
# desktop.3 br-vlan-3
# ----------------------
ip link add link enp9s0f1 name enp9s0f1.3 type vlan id 3
ip link set dev enp9s0f1.3 master br-vlan-3
ip link set enp9s0f1.3 up

# --------------------------
# desktop.100 br-trunk-vm
# --------------------------
ip link add link enp9s0f1 name enp9s0f1.100 type vlan id 100
ip link set enp9s0f1.100 master br-trunk-vm
ip link set enp9s0f1.100 up
bridge vlan add vid 100 dev enp9s0f1.100 master
bridge vlan add vid 100 dev br-trunk-vm self

bridge vlan add vid 100 dev fw.100 pvid 100

Network map

=======
DESKTOP
=======
localhost:user ~ $  ip a
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:d8:61:c4:b1:af brd ff:ff:ff:ff:ff:ff
4: br-vlan-100: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 1a:b1:36:43:f0:e4 brd ff:ff:ff:ff:ff:ff
    inet 10.66.100.44/24 scope global br-vlan-100
       valid_lft forever preferred_lft forever
7: enp.100@enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-vlan-100 state UP group default qlen 1000
    link/ether 00:d8:61:c4:b1:af brd ff:ff:ff:ff:ff:ff
    
localhost:~ # cat /proc/net/vlan/enp.100 
enp.100  VID: 100        REORDER_HDR: 1  dev->priv_flags: 1221
         total frames received            0
          total bytes received            0
      Broadcast/Multicast Rcvd            0

      total frames transmitted          287
       total bytes transmitted        53964
Device: enp34s0
INGRESS priority mappings: 0:0  1:0  2:0  3:0  4:0  5:0  6:0 7:0
 EGRESS priority mappings: 


==========
HYPERVISOR
==========
bridge name     bridge id               STP enabled     interfaces
br-vlan-100             8000.1ab13643f0e4       no              enp.100

(root@fedora system)# ip a  
4: enp9s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether a0:36:9f:5d:09:19 brd ff:ff:ff:ff:ff:ff
13: br-trunk-vm: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 56:7e:22:6a:23:2d brd ff:ff:ff:ff:ff:ff
16: enp9s0f1.100@enp9s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-trunk-vm state UP group default qlen 1000
    link/ether a0:36:9f:5d:09:19 brd ff:ff:ff:ff:ff:ff
21: fw.100: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-trunk-vm state UNKNOWN group default qlen 1000
    link/ether fe:54:00:3e:97:72 brd ff:ff:ff:ff:ff:ff
    
    
(root@fedora system)# brctl show dev br-trunk-vm
bridge name     bridge id               STP enabled     interfaces
br-trunk-vm             8000.567e226a232d       no              enp9s0f1.100
                                                        fw.100
                                                        fw.103
                                                        fw.3


===============
VIRTUAL MACHINE 
===============                                                                    
(root@fedora system)# bridge vlan show
port              vlan-id  
br-trunk-vm       100
enp9s0f1.100      100
virbr0            1 PVID Egress Untagged
fw.100            100 PVID Egress Untagged


2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:3e:97:72 brd ff:ff:ff:ff:ff:ff
    inet 10.66.100.10/24 scope global enp1s0
       valid_lft forever preferred_lft forever

Libvirt XML network configuration of the firewall VM:

<interface type='bridge'>
  <mac address='52:54:00:3e:97:72'/>
  <source bridge='br-trunk-vm'/>
  <target dev='fw.100'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>

3 Attempts

I tried configuring both a tagged and untagged NIC on the firewall VM. For the tagged NIC I created a VLAN bridge on the firewall VM and created a virtual tap device from the virtual tap fw.100 with the VLAN 100: vlan100@fw.100. Then I set the trunk port of vlan100@fw.100 to master: bridge vlan add vid 100 dev vlan100@fw.100 master. For the untagged NIC approach I configured no VLAN on the firewall VM and set its trunk port to PVID 100 untagged bridge vlan add vid 100 dev fw.100 pvid 100 untagged. In both cases I could not ping between the desktop host and the firewall VM.

This issue happens only with the libvirt KVM/QEMU virtual machine. Two physical VLAN tagged hosts connected to the hypervisor’s trunk bridge as master can ping each other.

How to configure Magento 2 to have personal/private develpment extensions just for myself

I have several development tools which I personally use like:

  • https://github.com/ho-nl/magento2-Ho_Templatehints
  • https://github.com/mage2tv/magento-cache-clean

Is it possible to somehow configure and use it for myself? Other team members are not using it.

The specific issues:

  • app/etc/config.php is in the repo, I cannot commit it
  • composer.json and composer.lock are in the repo, I cannot commit it

I would like to use both modules and enable them without changing any repo files. Would that be possible?

linux – How to configure Fedora 34 with three NICs and three subnets to route traffic?

I have a Fedora 34 linux and it has a physical ethernet interface (NIC3), a physical wifi interface (NIC2) and an USB/Ethernet interface (NIC1) (USB LTE Dongle).
I would like to use the NIC3 to route all traffic to NIC1. And I would like to keep the NIC2 as management interface that reach the Linux machine. That is all.
block scheme of the plan – click here to see the image

    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.8.1     0.0.0.0         UG    100    0        0 enp0s29f7u5
0.0.0.0         192.168.99.254  0.0.0.0         UG    600    0        0 wlp16s0
0.0.0.0         192.168.55.10   0.0.0.0         UG    20101  0        0 ens1
192.168.8.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s29f7u5
192.168.55.0    0.0.0.0         255.255.255.0   U     101    0        0 ens1
192.168.99.0    0.0.0.0         255.255.255.0   U     600    0        0 wlp16s0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

(root@thanos ~)# ip route show
default via 192.168.8.1 dev enp0s29f7u5 proto dhcp metric 100
default via 192.168.99.254 dev wlp16s0 proto dhcp metric 600
default via 192.168.55.10 dev ens1 proto static metric 20101
192.168.8.0/24 dev enp0s29f7u5 proto kernel scope link src 192.168.8.127 metric 100
192.168.55.0/24 dev ens1 proto kernel scope link src 192.168.55.10 metric 101
192.168.99.0/24 dev wlp16s0 proto kernel scope link src 192.168.99.142 metric 600
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

enp0s29f7u5: connected to Wired connection 2
        "Huawei E353/E3131"
        ethernet (cdc_ether), 00:1E:10:1F:00:00, hw, mtu 1500
        ip4 default, ip6 default
        inet4 192.168.8.127/24
        route4 0.0.0.0/0
        route4 192.168.8.0/24
        inet6 2a00:1110:209:1c4:763d:4da5:c8cf:5778/64
        inet6 2a00:1110:222:5201:5ff0:45bc:f54b:d523/64
        inet6 2a00:1110:209:1c4:10:2030:4050:2/128
        inet6 fe80::1c5e:de37:2e84:8fee/64
        route6 2a00:1110:222:5201::/64
        route6 2a00:1110:209:1c4::/64
        route6 ::/0
        route6 2a00:1110:209:1c4:10:2030:4050:2/128
        route6 fe80::/64

wlp16s0: connected to SB25
        "Intel PRO/Wireless 3945ABG"
        wifi (iwl3945), 00:1F:3C:87:2D:DE, hw, mtu 1500
        inet4 192.168.99.142/24
        route4 0.0.0.0/0
        route4 192.168.99.0/24
        inet6 fe80::ce52:130a:ec8a:39db/64
        route6 fe80::/64
        route6 ::/0

virbr0: connected (externally) to virbr0
        "virbr0"
        bridge, 52:54:00:60:80:14, sw, mtu 1500
        inet4 192.168.122.1/24
        route4 192.168.122.0/24

ens1: connected to System ens1
        "Broadcom and subsidiaries NetLink BCM5787M"
        ethernet (tg3), 00:1F:29:9D:A2:64, hw, mtu 1500
        inet4 192.168.55.10/24
        route4 192.168.55.0/24
        route4 0.0.0.0/0

EDIT1: (Additional Information)
Forward is enabled
Iptables is disabled

(root@thanos ~)# cat /proc/sys/net/ipv4/ip_forward
1
(root@thanos ~)# systemctl status iptables.service
○ iptables.service - IPv4 firewall with iptables
     Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Mon 2021-09-06 13:46:59 CEST; 57min ago
    Process: 2043 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
    Process: 2119 ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited, status=0/SUCCESS)
   Main PID: 2043 (code=exited, status=0/SUCCESS)
        CPU: 67ms

Sep 06 13:45:54 thanos systemd(1): Starting IPv4 firewall with iptables...
Sep 06 13:45:54 thanos iptables.init(2043): iptables: Applying firewall rules: (  OK  )
Sep 06 13:45:54 thanos systemd(1): Finished IPv4 firewall with iptables.
Sep 06 13:46:59 thanos systemd(1): Stopping IPv4 firewall with iptables...
Sep 06 13:46:59 thanos iptables.init(2119): iptables: Setting chains to policy ACCEPT: filter (  OK  )
Sep 06 13:46:59 thanos iptables.init(2119): iptables: Flushing firewall rules: (  OK  )
Sep 06 13:46:59 thanos systemd(1): iptables.service: Deactivated successfully.
Sep 06 13:46:59 thanos systemd(1): Stopped IPv4 firewall with iptables.

Configure cluster on an existing SQL Server – to setup AlwaysOn Availability Groups

We are already having an SQL Server Enterprise Edition instance running on an Physical Server. Now to configure AlwaysOn Availability Groups

  1. Can we configure WSFC (Windows Server Failover Cluster) Services on existing SQL server instance?
  2. Or uninstall SQL Server, install WSFC and then install SQL again? (this may not be a best thing, as they are holding huge DB’s.)

As we are planning a 3-node (all are physical machines and currently running SQL instances) cluster, how to move ahead? What options to select from the installation media to proceed with AlwaysOn Availability Groups configuration. Thanks

linux – How can I configure Wireguard running in a docker container on a VPS to allow communication between its’ connected clients?

I have a VPS running WireGuard as a server in a docker container, where I’ve given it the devices I intend on adding as peers.

I have a home server running WireGuard as a client in a docker container using the host network mode. IP Forwarding is enabled on each of these servers.

When I connect with my laptop to the WireGuard host on the VPS, I’m unable to access my home server.

Am I approaching this wrong, or is there a simpler/better way to try to achieve this?
One of the reasons I’m wanting to configure this in this way is so that I can set up a reverse proxy to one of the services running on the home server over the tunnel.

sql server – Ola Hallengren Maint Solution: How to configure Index Optimize and Integrity Check for AO Group

I’m trying to configure both index optimization and integrity check for databases that are part of AO group. The documentation says that those jobs should be enabled on all servers that are part of the AO and the script should be identical.

Will this configuration be enough?

EXECUTE [dbo].[DatabaseIntegrityCheck]
@Databases = 'AVAILABILITY_GROUP_DATABASES',
@LogToTable = 'Y'

What about job schedule, should all the jobs run at the same time on all servers?

Bitcoin-qt attempts to load its old wallets. How can I configure it so that it does not do it?

Warning: Skipping -wallet path that doesn’t exist. Failed to load database path ‘/home/jerzy/.bitcoin/testnet3/wallets/blank’. Path does not exist.

I get this warning anytime I launch it with nohup ~/bitcoin/bin/bitcoin-qt --conf=/home/jerzy/.bitcoin/bitcoinT.conf &.

The content of the respective configuration file is:

testnet=1
keypool=3

It seems that bitcoin-qt attempts to load old and non-existing in .bitcoin/wallets wallets, but only those created with bitcoin-qt, and not those
from with bitcoin-cli. From what file does bitcoin-qt get the information about the old wallets? How can I stop this behaviour?

How you configure Multi servers to have multi nameserver

Hello
some of company has 2 different name server that point to different IP
ns1 > ip1
ns2 > ip 2

in this case if they are a Hosting c… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1855446&goto=newpost