duplicated Gateway msgs flood my logfile

Started by vbandke, August 18, 2023, 08:33:34 PM

Previous topic - Next topic
August 18, 2023, 08:33:34 PM Last Edit: August 19, 2023, 11:08:43 AM by vbandke
Hello from Germany,

I have been using opnsense for a while now, with no issues.


Recently I upgraded to Version 23.1.11, and today I noticed that my log file gets clogged with messages every two or three second
2023-08-18T20:21:53 Warning opnsense Gateway: duplicated entry "WAN_GWv4" in config.xml needs manual removal
2023-08-18T20:21:51 Warning opnsense Gateway: duplicated entry "WAN_GWv4" in config.xml needs manual removal
2023-08-18T20:21:48 Warning opnsense Gateway: duplicated entry "WAN_GWv4" in config.xml needs manual removal
2023-08-18T20:21:45 Warning opnsense Gateway: duplicated entry "WAN_GWv4" in config.xml needs manual removal
2023-08-18T20:21:43 Warning opnsense Gateway: duplicated entry "WAN_GWv4" in config.xml needs manual removal
2023-08-18T20:21:40 Warning opnsense Gateway: duplicated entry "WAN_GWv4" in config.xml needs manual removal


Needless to say that I neither changed anything in the gateway settings, nor did I modify the config.xml.  Therefore I would like to know

  • What might be/is the cause of the warning msgs?
  • Where is the config.xml?

    • Is this the file that can be downloaded via System-->Configuration-->Backups ?
    • Should I edit the downloaded file and reupload it
  • And, most important: What part would I need to edit/remove?

With best regards from Germany


Volker Bandke

Edited:  Corrected some typos

Edited2:  Just for fun, I upgraded to Version 23.7.1, but the issue (and thus the questions) persist

Volker

September 25, 2023, 10:36:17 PM #1 Last Edit: September 25, 2023, 10:40:42 PM by labsy
Same in my just upgraded box:

2023-09-25T22:34:06 Warning dpinger Gateway: duplicated entry "GW_WAN" in config.xml needs manual removal
2023-09-25T22:34:06 Warning dpinger Gateway: duplicated entry "GW_WAN" in config.xml needs manual removal
2023-09-25T22:34:05 Warning dpinger Gateway: duplicated entry "GW_WAN" in config.xml needs manual removal
2023-09-25T22:34:05 Warning dpinger Gateway: duplicated entry "GW_WAN" in config.xml needs manual removal
2023-09-25T22:34:04 Warning dpinger Gateway: duplicated entry "GW_WAN" in config.xml needs manual removal


Maybe usefull for debugging:
I had 19.1 version, pulled out config, setup new 23.7 virtual machine, then ran wizard just to get access to web interface, then I imported old config. Maybe Wizard put duplicated GW_WAN entries there?

Yes, this was discovered just this year and subsequently fixed in 23.1.8:

https://github.com/opnsense/core/commit/db69027dd

The bug was there since maybe a decade or two.

The config.xml still needs to be edited manually in this case.


Cheers,
Franco

Thank you for confirmation, Franco!

BTW...manually editing config.xml? Is this just plain simple, like SSH to OPNSense box, locate config.xml, edit & save?

SSH or console, yes. I made a tool for 23.7.5 to be able to more safely navigate config.xml and drop bad values:

# pluginctl -g gateways.gateway_item.0

It's one of 0 ... (n - 1) and you can see by name attribute which gateway numbers are the duplicates.

Pick the one that's less likely to be the current one (this can be a little tricky) and then drop it:

# pluginctl -f gateways.gateway_item.x

(x for gateway number to drop)

The system creates a backup of the former content to be able to revert to it if this isn't what you wanted.


Cheers,
Franco

Will try your plugin...I have 3 instances of GW_WAN and have no idea, which one is in use...

  <gateways>
    <gateway_item>
      <descr>Interface wan Gateway</descr>
      <ipprotocol>inet</ipprotocol>
      <interface>wan</interface>
      <gateway>1.2.3.4</gateway>
      <name>GW_WAN</name>
      <weight>1</weight>
      <interval>1</interval>
    </gateway_item>
    <gateway_item>
      <descr>Interface WAN Gateway</descr>
      <defaultgw>1</defaultgw>
      <ipprotocol>inet</ipprotocol>
      <interface>wan</interface>
      <gateway>1.2.3.4</gateway>
      <monitor_disable>1</monitor_disable>
      <name>GW_WAN</name>
      <interval>1</interval>
      <weight>1</weight>
    </gateway_item>
    <gateway_item>
      <descr>Interface WAN Gateway</descr>
      <defaultgw>1</defaultgw>
      <ipprotocol>inet</ipprotocol>
      <interface>wan</interface>
      <gateway>1.2.3.4</gateway>
      <monitor_disable>1</monitor_disable>
      <name>GW_WAN</name>
      <interval>1</interval>
      <weight>1</weight>
    </gateway_item>
  </gateways>

If you use gateway monitoring it's definitely the first one that's being used. The other two have monitoring turned off.


Cheers,
Franco

Excellent observations, thanx! I spent half an hour to determine which is which, now you made it easy :)

After reboot I've got this in log:
2023-09-26T21:00:58 Warning opnsense /usr/local/sbin/pluginctl: warning: ignoring missing default tunable request: net.inet.ip.fastforwarding
2023-09-26T21:00:58 Warning opnsense /usr/local/sbin/pluginctl: warning: ignoring missing default tunable request: debug.pfftpproxy
2023-09-26T21:00:56 Warning opnsense /usr/local/etc/rc.newwanip: Interface '' (ovpns1) is disabled or empty, nothing to do.
2023-09-26T21:00:55 Error dhcp6c transmit failed: Can't assign requested address
2023-09-26T21:00:55 Error opnsense /usr/local/etc/rc.bootup: ROUTING: not a valid default gateway address: ''


So I went to GW settings and marked it as default UPSTREAM. After applying I've got:
2023-09-26T21:35:20 Error opnsense /system_gateways.php: ROUTING: not a valid default gateway address: ''

The gateway was static "1.2.3.4" in all three gateways. Coming up as "" empty is not possible unless it tried to use something else as upstream gateway that didn't have an address. Good catch on the upstream setting -- that's certainly something that I missed.

The log is incomplete without notice level. The messages are errors and warnings but notice level gives the full context (including which interfaces it tried to use). It it a bit funny because people were hell-bent on wanting to not see everything logged as error and now it's less useful the way it is.

Long story sort it seemed your IPv6 Internet failed to come up causing all sorts of issues (OpenVPN, IPv6, no viable default route).


Cheers,
Franco

Good point - IPv6!
Dunno if I need it, or rather want it. We were all talking about it years ago, IPv4 will get out of number space....now all somehow settled down, I actually forget about it, ecept if somebody points it out just like you did :)
You were right - DEBUG level revealed one message before error:
2023-09-26T21:35:20 Error opnsense /system_gateways.php: ROUTING: not a valid default gateway address: ''
2023-09-26T21:35:20 Notice opnsense /system_gateways.php: ROUTING: configuring inet6 default gateway on wan


Regarding tunnables errors.... I just went to SYSTEM --> TUNABLES and swept for coloured settings, which were all long time obsolete. Deleted them and got rid of those warnigns in log.

Thank you very much for helping me out!

The IPv6 depends on your ISP. The OPNsense default is to try DHCPv6 and sometimes this is problematic or not the right connectivity type. Can't say much more about it from here.

It tries to use the gateway but comes up empty. Do you have the gateway selected in your IPv4 settings under Interfaces: [WAN]. Is IPv4 not connecting at the moment?


Cheers,
Franco

IPv4 GW is now marked as default and is working just fine. By disabling IPv6 gateway I also got rid of above mentinoed error, so I guess all is working fine now.