iptables – Route container traffic to specific interface and keep internal communication

I have a linux host with 2 interfaces:

  • enp7s0 (192.168.8.1/24): FTTH Fiber (Access to the internet)
  • enp8s0 (10.15.3.1/24) : LAN + Internet Access (default interface linked to docker0 bridge)

I am looking to have a docker bridge where containers connected to it will have their traffic going through enp7s0 instead of enp8s0.

So far what I did is create a docker bridge network called bridge-coi:

bridge-coi:
    name: bridge-coi
    driver_opts:
      com.docker.network.bridge.enable_ip_masquerade: 'false'
    external: false
    ipam:
      driver: default
      config:
        - subnet: "172.18.0.0/16"

Then I used the following routes and iptables rules:

/sbin/ip route add 172.18.0.0/16 dev enp7s0 tab 1
/sbin/ip route add default via 192.168.8.1 dev enp7s0 tab 1
/sbin/ip rule add from 172.18.0.0/16 tab 1
/sbin/ip route flush cache
/sbin/iptables -t nat -A POSTROUTING -s 172.18.0.0/16 ! -o bridge-coi -j SNAT --to-source 192.168.8.100

This works well as all the traffic from the containers linked to this interface is going through enp7s0 and if I check the public IP of containers it is indeed the IP of enp7s0

But the issue I have now is that all containers connected to this bridge (bridge-coi) are not able to ping and reach each others:

ping 172.18.0.2
PING 172.18.0.2 (172.18.0.2): 56 data bytes
^C
--- 172.18.0.2 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss

Any ideas what is going-on there ?

why java List interface implements 10 methods of(..) instead of just one varargs version?

With absolutely no prior knowledge of the specific case, I would guess: performance.

Given a function with a fixed set of parameters, a compiler can optimise how those parameters are laid out in memory, and even optimise the entire function to a fixed set of processor instructions.

A generalised implementation instead needs machinery for detecting the number of parameters actually passed, collecting them into some intermediate representation, and iterating over them.

Consider an example of sum, in an imaginary language, implemented variadically:

function sum(int() ...args) {
    local accumulator = 0;
    foreach ( args as next_arg ) {
        accumulator += next_arg;
    }
    return accumulator;
}

Even without knowing the low-level mechanics of passing and allocating variables, we can see that there’s a lot going on here. Now compare to implementations with fixed argument lists:

function sum(int a) { return a; }
function sum(int a, int b) { return a + b; }
function sum(int a, int b, int c) { return a + b + c; }
function sum(int a, int b, int c, int d) { return a + b + c + d; }

Here, no intermediate storage needs to be allocated for args and accumulator, and the implementations are easy to map to low-level instructions.

While it’s possible for a sufficiently powerful compiler to generate the optimised cases from the generalised one, it’s far from easy. So where performance matters more than human convenience, it can be worth hand-crafting at least some of the cases.

info visualisation – Intuitive interface for Composing Boolean Logic?

There’s quite a few good ideas/references here, especially to some existing approaches. Often, though not always, Apple’s approach is a good place to start – but perhaps in your case it may not be. I get the impression (though you haven’t actually said it) that you’re working with an awful lot of data comprised of many many fields/variables.

I agree that trying to find a way to simplify it for less technical users is a good idea, so long as you expect to have less technical users using the system. Otherwise developing a less complicated interface may be a lot of work for little gain. I also like the idea of a Venn diagram – would be interesting to see how that pans out.

However, in terms of actual suggestions on how to simplify this, another approach would be to just create some sort of “Wizard” process that steps the user through the process with a combination of natural language and a familiar ‘web’ look and feel. Below is a mockup of how this could work, using an example of a motor vehicle database:

enter image description here

The above shows how Step 1 could work, giving users a number of options they can select by ticking the relevant checkbox. They can select one or more checkboxes as necessary (or maybe not any?!). If they select a checkbox for an option that requires further info then the relevant words are hyperlinked. Clicking on the hyperlinked words would present the user with something like the example below:

enter image description here

So, the example above shows what a user may see if they’ve selected the “Vehicle is produced by particular manufacturers” checkbox and then clicked on the hyperlinked text to select the manufacturer(s) they want included in the search results. Of course your approach may differ depending on whether they should see a free text field, a drop-down list of options, etc.

Now, to deal with any “exceptions” to the search criteria, you would basically recreate the first window again, but with different wording, like:

enter image description here

So, after selecting the fuel exception above, the user clicks on the hyperlinked words “particular fuel” to choose the exception as below:

enter image description here

Once again, this could be a drop-down list, radio buttons, etc depending on what best suits the condition. They would also go through the same process to select the country they didn’t want the vehicle to be manufactured in.

Of course, I see this “Wizard” approach as being for less technical users. You would also offer an “Advanced” option for users comfortable with a more complicated approach that may be streamlined compared to the Wizard approach.

ADDENDUM

Okay, this kept me up last night. I actually see this Wizard approach as being quite a good way to go, so thought it worth coming back to improve on my answer as it may help someone else if not you.

I’ve updated the mockup images above and wanted to expand on your idea of using a split screen.

Originally I thought that after the last step was complete, then something like your Venn diagram idea could be used to visually indicate what the user has chosen. But then I thought about my original assertion that there should also be a way for the user to go back and forth to amend their criteria. So now I’m thinking that using your split screen you could achieve both. Below is a new image to illustrate what I’m thinking:

Split screen view

So, the above is an example of what could appear in the second part of your split screen. As the user selects their criteria, this updates to indicate what their selections have been. This approach also uses the familiar web look and feel of highlighting their choices with hyperlinks and, if they wanted to, they could change their criteria by clicking on the hyperlinks within this screen, rather than having to go back and forth between screens to redo their steps. Of course, if they wanted to select a new condition, they would need to perhaps go back to the relevant step. But you get the idea.

The only other thing I’d like to mention is that without knowing the complexity of your data, you may need to refine this Wizard approach. My simple vehicle database only needs two steps, but a complicated one may need more steps. The point of this approach though, is not so much in the number of steps, but in the fact that the Wizard ‘talks’ people through the steps using natural language as much as possible.

Anyway, I hope this, along with the other answers provided, gives you some food for thought. And perhaps some others. This is a good topic and one which I think will be relevant to many users.

Good luck!

linux – Reply on same interface as incoming when using a failover IP

I have multiple devices sending data to a Debian 9 server.

My infrastructure is as follow :

           X.X.X.X
          |--Public IP------|          |     |                |
Debian 9  |                 | Internet |-----| Device Gateway |------ Devices
          |--Failover IP ---|          |     |                |
           Y.Y.Y.Y                            Z.Z.Z.Z

All devices send their data from a device gateway so all messages from the devices have a source IP of Z.Z.Z.Z and have a destination IP to either X.X.X.X or Y.Y.Y.Y depending on the device configuration.
When the server receive the data from the device, it sends an ack which the device requires to have the same source IP that it sent the data to or it will refuse the ACK.

The problem is that if the device sends the data to the failover IP, the server will try to reply with its public IP.
I’d like the server to reply with the same IP it received the data on.

the failover ip interface is configured like this :

auto ens3:0
iface ens3:0 inet static
        address Y.Y.Y.Y
        netmask 255.255.255.255

My first try was to follow this post :
https://unix.stackexchange.com/questions/4420/reply-on-same-interface-as-incoming

I added rules like so :

echo 200 pub >> /etc/iproute2/rt_tables
echo 201 fo >> /etc/iproute2/rt_tables
ip rule add from X.X.X.X table pub prio 1
ip route add default via gateway_IP dev ens3 table pub
ip rule add from Y.Y.Y.Y table fo prio 2
ip route add default via gateway_IP dev ens3:0 table fo

However, using tshark I can verify that the rules are not used and that the main default route is used :

default via gateway_IP dev ens3

The Debian 9 server is a Public Cloud instance at OVH. I don’t have access to the device Gateway however. I feel like this kind of ip rules are not working when using subinterfaces like ens3:0. Did I do something wrong or should I use something else like iptables ?

vpn – Specify outgoing network interface in ipsec.conf for one IPSec tunnel?

I’d like one of my tunnels to go out a particular interface. Is there a way to specify it?

ipsec.conf

conn remotehost.example.org
keyexchange=ikev2
type=tunnel
authby=psk
rekey=yes
keyingtries=%forever
ike=aes128gcm128-aesxcbc-modp2048!
ikelifetime=28800s
esp=aes128gcm128-modp2048!
lifetime=3600s
dpddelay=30
dpdtimeout=120
dpdaction=restart
left=%defaultroute
leftid=myhost.example.com
leftsubnet=10.0.0.1/16
leftfirewall=yes
right=remotehost.example.org
rightid=remotehost.example.org
rightsubnet=10.5.0.0/16
rightfirewall=yes
auto=start

Both the left and right hosts have dynamic IP addresses, so it is not trivial to do this with routing.

OpenVPN server interface sharing issues on Windows Server 2019

Let me explain my problem to you. I put OpenVPN on a Windows Server 2019. However I have a problem with the network interface sharing. When I restart the server. The sharing doesn’t work anymore. I need to disable the sharing and reactivate it and restart the OpenVPN services for it to work. Would you have a solution to offer me ?

forms – How can I improve a Bulk Upload interface?

I need to do some sort of form for bulk uploading information, which will then be converted to a data table for individual editing.

The thing is I have some setbacks because of the way it was built. I can’t change any of this sadly, I’m trying to at least make it as usable as possible.

  • I don’t have much space available as it’s made inside a modal.
  • I was discouraged to use a table instead of text fields (the user just wants to copy and paste the information is what I was told)
  • There are too many fields (25+ fields) that make the modal scroll both ways (horizontal and vertical)

The flow goes like this:

  1. The user selects bulk uploading and a modal pops.
  2. The user then copies and pastes a list with information for each text field and selects the dropdowns (it’s just one dropdown per upload), when clicking save the modal closes and saves the information.
  3. The program pairs the information of each text field and makes it into a data table with individual editing options (bulk editing is no longer available). Individual editing is made with a 3-step wizard.

This is how the bulk uploading is right now.

This is what the user sent me

Any suggestion is greatly appreciated!

forms – Interface for bulk uploading with fields

I need to do some sort of form for bulk uploading information, which will then be converted to a data table for individual editing.

The thing is I have some setbacks because of the way it was built. I can’t change any of this sadly, I’m trying to at least make it as usable as possible.

  • I don’t have much space available as it’s made inside a modal.
  • I was discouraged to use a table instead of text fields (the user just wants to copy and paste the information is what I was told)
  • There are too many fields (25+ fields) that make the modal scroll both ways (horizontal and vertical)

The flow goes like this:

  1. The user selects bulk uploading and a modal pops.
  2. The user then copies and pastes a list with information for each text field and selects the dropdowns (it’s just one dropdown per upload), when clicking save the modal closes and saves the information.
  3. The program pairs the information of each text field and makes it into a data table with individual editing options (bulk editing is no longer available). Individual editing is made with a 3-step wizard.

This is how the bulk uploading is right now.

This is what the user sent me

Any suggestion is greatly appreciated!

unity – How can I call Schedule() on interface that inherits from IJob

So I have a voxel terrain engine, and I have an interface that all meshing jobs should inherit from. That looks like this (simplified from the actual):

public interface IMesherJob : IJob
{
    VoxelDataVolume<byte> VoxelData { get; set; }

    NativeArray<MeshingVertexData> OutputVertices { get; set; }
    NativeArray<ushort> OutputTriangles { get; set; }
}

One example of a meshing job is marching cubes, which looks like this: public struct MarchingCubesJob : IMesherJob

So here’s my question: If I have a reference to an IMesherJob, can I somehow call Schedule on it? If I have a reference to MarchingCubesJob, I can call Schedule on it:

This works:

MarchingCubesJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64)

But this does not work:

IMesherJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64);

I noticed that Schedule() is an extension method for T where T : struct, IJob so that might be interfering with it, but it should still work because IMesherJob inherits from IJob

magento2.3 – PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento 2.3

When running php bin/magento setup:upgrade i see this error.

{"messages":{"error":({"code":500,"message":"Server internal error. See details in report api/499296787794"})}}

Searching on my error_log_php i see this

    PHP Fatal error:  Uncaught Error: Cannot instantiate interface MagentoDownloadableApiDomainManagerInterface in /home/user/MySite/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50
Stack trace:
#0 /home/user/MySite/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create('Magento\Downloa...')
#1 /home/user/MySite/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): MagentoFrameworkObjectManagerObjectManager->get('Magento\Downloa...')
#2 /home/user/MySite/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument(Array, 'Magento\Downloa...', NULL, 'domainManager', 'Magento\Downloa...')
#3 /home/user/MySite/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): MagentoFrameworkObje in /home/user/MySite/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

I’ve seen suggestions for deleting var and generated folder, but it didn’t work.
I’m interested in solving this since I need to install a new module.

What could be the issue, and I could solve this?


EDIT

I’ve also found that it could be a problem related to the leftovers of a badly removed module. If that is the case, how could I check for it? I haven’t installed anything recently, so any issue related to this would be hard to track only with memory.