2

I'm migrating old ubuntu install to 18 version, but it seems to have some static routing issues when using different networks.

First, I tried using NetPlan. I configured TWO NICS with different networks on each one, but, I dont know if this is a kernel issue (maybe missing some module) or if its a ubuntu 18 problem (doubt that).

The sympton is that only default route is working. I can add multiple NICs with different networks and static routes and gateways, but only the default route will work.

Here is my NetPlan config file:

network:
    version: 2
    renderer: networkd
    ethernets:
        ens32:
            addresses:
                - 177.185.x.66/29
                - 177.185.x.67/29
                - 177.185.x.68/29
                - 177.185.x.69/29
                - 177.185.x.70/29
            gateway4: 177.185.x.65
            nameservers:
                addresses:
                - 8.8.8.8
                search:
                - mydomain.net
            routes:
                    - to: 0.0.0.0/0
                      via: 177.185.x.65
            optional: true
        ens34:
            addresses:
                - 168.96.x.2/24
            routes:
                    - to: 168.96.x.0/24
                      via: 168.96.x.1

The NetPlan works almost fine: no issue when applying new config. Routing table looks normal:

default via 177.185.x.65 dev ens32 proto static 
168.96.x.0/24 via 168.96.x.1 dev ens34 
168.96.x.0/24 dev ens34 proto kernel scope link src 168.96.x.10 
177.185.x.64/29 dev ens32 proto kernel scope link src 177.185.x.66

But I can only ping the 177.185.x.64/29 network. The other one doesn't respond.

When I change the default route to the secondary network (168.96.x.0/24), the other one stops responding.

I first thought that it might be related to IP routing kernel modules, but I couldn't find the same options from older kernels on the 4.15 one.

Any help would be much appreciated.

Thanks in advance.

BR, Rafael

  • this is a bit old, but it looks as tho the YAML above is wrong in that your array of routes is indented too much. the [dash] char below "routes:" should be the same 4-char indent as the [dash] char you see beneath "addresses:" – ericx Jun 7 at 18:04
0

First, ifupdown package is deprecated and won't work anymore. So you would better avoid that.

Second, apparently you didn't understand what I wrote you before on my thread: the us of routing table.

As mentioned here, any given OS has only one possible gateway. same for router or any other devices. If you want multiple gateways, you need then a duplicate system because the metadata of any given network packages transmitted on the network can't mention multiple gateways. That's why we need different routing tables. And I don't see anywhere on your file a line with the creation of another routing table. That's why you don't have any acknowledgements of arriving packets on the second interface... simple as that. The packages are arriving, they are just not be acknowledged because they can't be.

If you look at my solution which I linked earlier, you clearly see the tables and so the system know what to create and how to create it. Simple as that. And I frankly don't see why you are resisting about it....

  routes:
   - to: 0.0.0.0/0
     via: 192.168.3.1
     metric: 100
     table: 101

That's a creation of a routing policy + the specific table attached to it.

  routing-policy:
   - from: 192.168.3.0/24
     table: 101

that's the creation of the rule who specifies the need to register all incoming packets and sending packets in that table.

Plus I would strongly advise you, to do a vector/table of your static addresses in place of a list. So more something like that [.../..,.../..,.../..]. Again, like in my example.

  • Hi @vigilian.. thanks for the tip! In older version we didn't have to add those new routing tables, it was much easier. I don't understand why they made it more complex. The ifupdown method that just works on almost every Linux distribution is not working anymore on Ubuntu after NetPlan was implemented on Ubuntu. I'll try that later today and let you know if it worked. Thanks a lot for the help. This is a light at the end of the tunnel. BR. Rafael – Rafael Azevedo Jun 13 '18 at 23:21
  • that's where you are wrong @RafaelAzevedo. since 12.04 and even before you weren't able to do a 2 gateways system. NEVER. unless you specified a table to store the information for the second gateways like explain here as mentioned before: askubuntu.com/questions/310355/networking-with-multiple-nics/… in the point setup new routing table with the command post-up ip route add default via 192.168.1.65 dev eth1 table 101 . So I'm pretty sure you are confused with something else. – vigilian Jun 14 '18 at 16:06
  • @vigilian would the table declaration have to be manually added to /etc/iproute2/rt_tables? – Arya Jun 21 '18 at 6:16
  • @Arya why if that was the case, we would add the 2 commands in post up in the case of ifupdown and the the declaration of the table number in nplan. So the the answer is no. The system hasn’t change from ifupdown to Nplan. We are just now using the yaml syntax that’s all basically. – vigilian Jun 21 '18 at 6:21
  • @Arya at least to a user level. Not of course for the system. A lot has changed behind the scene. Just follow the links that I’ve provided . There is enough information for nplan and for ifupdown – vigilian Jun 21 '18 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.