ValueError: Undefined does not appear to be an IPv4 or IPv6 network

I try to delete the IPs Address and put others:

zqz@vyos01.dev# show interfaces openvpn 
 openvpn vtun10 {
     device-type tap
     local-port 1194
     mode server
     protocol udp
     server {
         client mikrotik1 {
             ip 192.168.1.10
             subnet 192.168.1.128/25
         }
         push-route 192.0.0.0/16 {
         }
         subnet 192.168.1.0/25
     }
     tls {
         ca-cert-file /config/auth/openvpn/ca.crt
         cert-file /config/auth/openvpn/bras_zqz.crt
         crl-file /config/auth/openvpn/crl.pem
         dh-file /config/auth/openvpn/dh.pem
         key-file /config/auth/openvpn/bras_zqz.key
     }
 }
[edit]

I use this for delete:

zqz@vyos01.dev# delete interfaces openvpn vtun10 server client mikrotik1 ip 192.168.1.10 

zqz@vyos01.dev# delete interfaces openvpn vtun10 server client mikrotik1 subnet 192.168.1.128/25 

zqz@vyos01.dev# delete interfaces openvpn vtun10 server push-route 

zqz@vyos01.dev# delete interfaces openvpn vtun10 server subnet

And now set a new IP

zqz@vyos01.dev# set interfaces openvpn vtun10 server client mikrotik1 ip 100.67.67.1

This is the change gonna be applied:

zqz@vyos01.dev# show interfaces
 bridge br0 {
     member {
         interface vtun10 {
         }
     }
     mtu 1557
 }
 ethernet eth0 {
     address dhcp
     address dhcpv6
     firewall {
         local {
         }
     }
     hw-id 12:38:f3:b2:85:51
 }
 loopback lo {
 }
 openvpn vtun10 {
     device-type tap
     local-port 1194
     mode server
     protocol udp
     server {
         client mikrotik1 {
-            ip 192.168.1.10
+            ip 100.67.67.1
-            subnet 192.168.1.128/25
         }
-        push-route 192.0.0.0/16 {
-        }
-        subnet 192.168.1.0/25
     }
     tls {
         ca-cert-file /config/auth/openvpn/ca.crt
         cert-file /config/auth/openvpn/bras_zqz.crt
         crl-file /config/auth/openvpn/crl.pem
[edit]

But now when I try to do a “commit”, give me this output:

zqz@vyos01.dev# commit
[ interfaces openvpn vtun10 ]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
  https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
  https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
  https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
  https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your 
  business policy requires it)
- and include all the information presented below

Report time:      2024-02-07 06:53:22
Image version:    VyOS 1.3.5-20231222143039
Release train:    equuleus

Built by:         support@vyos.io
Built on:         Fri 22 Dec 2023 14:30 UTC
Build UUID:       b0401111-aa24-4a23-98c5-b08e6e8e4658
Build commit ID:  8073d93558df04

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  Amazon EC2
Hardware model:   t3.small
Hardware S/N:     ec2811bf-b800-ca4b-0744-5f435cce61c0
Hardware UUID:    ec2811bf-b800-ca4b-0744-5f435cce61c0

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces-openvpn.py", line 546, in <module>
    generate(c)
  File "/usr/libexec/vyos/conf_mode/interfaces-openvpn.py", line 489, in generate
    user=user, group=group)
  File "/usr/lib/python3/dist-packages/vyos/template.py", line 117, in render
    rendered = render_to_string(template, content, formater, location)
  File "/usr/lib/python3/dist-packages/vyos/template.py", line 86, in render_to_string
    rendered = template.render(content)
  File "/usr/lib/python3/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/usr/share/vyos/templates/openvpn/client.conf.tmpl", line 4, in top-level template code
    ifconfig-push {{ ip[0] }} {{ server_subnet[0] | netmask_from_cidr }}
  File "/usr/lib/python3/dist-packages/vyos/template.py", line 182, in netmask_from_cidr
    return str(ip_network(prefix).netmask)
  File "/usr/lib/python3.7/ipaddress.py", line 84, in ip_network
    address)
ValueError: Undefined does not appear to be an IPv4 or IPv6 network



[[interfaces openvpn vtun10]] failed
Commit failed
[edit]
zqz@vyos01.dev#

Not sure, but maybe ‘subnet’ is required.

You are right, currently I leave the configuration like this:

  openvpn vtun10 {
      device-type tap
      keep-alive {
          interval 60
      }
      local-port 1194
      server mode
      persistent-tunnel
      udp protocol
      server {
          client mikrotik1 {
              ip 100.67.67.10
          }
          subnet 100.67.67.128/25
      }
      tls {
          ca-cert-file /config/auth/openvpn/ca.crt
          cert-file /config/auth/openvpn/bras_zqz.crt
          crl-file /config/auth/openvpn/crl.pem
          dh-file /config/auth/openvpn/dh.pem
          key-file /config/auth/openvpn/bras_zqz.key
      }
  }

Try deleting the subnet:

zqz@vyos01.dev# delete interfaces openvpn vtun10 server subnet 100.67.67.128/25
[edit]
zqz@vyos01.dev# commit
[openvpn vtun10 interfaces]
VyOS had an issue completing a command.

We are sorry that you encountered a problem while using VyOS.
There are a few things you can do to help us (and yourself):
- Contact us using the online help desk if you have a subscription:
   https://support.vyos.io/
- Make sure you are running the latest version of VyOS available at:
   https://vyos.net/get/
- Consult the community forum to see how to handle this issue:
   https://forum.vyos.io
- Join us on Slack where our users exchange help and advice:
   https://vyos.slack.com

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your
   business policy requires it)
- and include all the information presented below

Report time: 2024-02-08 02:11:31
Image version: VyOS 1.3.5-20231222143039
Release train: equuleus

Built by: support@vyos.io
Built on: Fri 22 Dec 2023 14:30 UTC
Build UUID: b0401111-aa24-4a23-98c5-b08e6e8e4658
Build commit ID: 8073d93558df04

Architecture: x86_64
Boot via: installed image
System type: KVM guest

Hardware vendor: Amazon EC2
Hardware model: t3.small
Hardware S/N: ec2811bf-b800-ca4b-0744-5f435cce61c0
Hardware UUID: ec2811bf-b800-ca4b-0744-5f435cce61c0

Traceback (most recent call last):
   File "/usr/libexec/vyos/conf_mode/interfaces-openvpn.py", line 546, in <module>
     generate(c)
   File "/usr/libexec/vyos/conf_mode/interfaces-openvpn.py", line 489, in generate
     user=user, group=group)
   File "/usr/lib/python3/dist-packages/vyos/template.py", line 117, in render
     rendered = render_to_string(template, content, format, location)
   File "/usr/lib/python3/dist-packages/vyos/template.py", line 86, in render_to_string
     rendered = template.render(content)
   File "/usr/lib/python3/dist-packages/jinja2/asyncsupport.py", line 76, in render
     return original_render(self, *args, **kwargs)
   File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
     return self.environment.handle_exception(exc_info, True)
   File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
     reraise(exc_type, exc_value, tb)
   File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
     raise value.with_traceback(tb)
   File "/usr/share/vyos/templates/openvpn/client.conf.tmpl", line 4, in top-level template code
     ifconfig-push {{ ip[0] }} {{ server_subnet[0] | netmask_from_cidr }}
   File "/usr/lib/python3/dist-packages/vyos/template.py", line 182, in netmask_from_cidr
     return str(ip_network(prefix).netmask)
   File "/usr/lib/python3.7/ipaddress.py", line 84, in ip_network
     address)
ValueError: Undefined does not appear to be an IPv4 or IPv6 network



[[openvpn vtun10 interfaces]] failed
Commit failed
[edit]
zqz@vyos01.dev#

And again it shows the error

It is must to configure the subnet parameter from which client IPs are allocated in openvpn server mode. A more detailed commit error can be seen 1.3.5 and 1.4.0-rc1, this what I see in my lab device:

vyos@vyos# del int openvpn vtun20 server subnet
[edit]
vyos@vyos# comp
[edit interfaces openvpn vtun20 server]
-subnet 100.67.67.128/25
[edit]
vyos@vyos# commit

Must specify "server subnet" or add interface to bridge in server mode

[[interfaces openvpn vtun20]] failed
Commit failed
[edit]
vyos@vyos# run sh ver

Version:          VyOS 1.3.5
Release train:    equuleus

Built by:         Sentrium S.L.
Built on:         Mon 04 Dec 2023 21:36 UTC
Build UUID:       c459bdc8-b253-4e7d-af80-d21e91402e20
Build commit ID:  d5f3d5002ffbe9

Architecture:     x86_64
Boot via:         installed image
System type:      KVM guest

Hardware vendor:  innotek GmbH
Hardware model:   VirtualBox
Hardware S/N:     0
Hardware UUID:    f5ac9b32-c97d-b24b-9a7b-5722c403550d

Copyright:        VyOS maintainers and contributors

Please test in 1.3.5 LTS release or in latest rolling release.

Thank you very much for the suggestion, I will do so.
Since I am also testing IPOE services with an external radius server through OpenVPN and the VyOS is not correctly sending the username (I need more tests) to the radius server, it may be fixed with these more recent versions.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.