[SOLVED] sitnl_send Invalid argument, Linux can't add IP to interface tun2

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
Domitian
OpenVpn Newbie
Posts: 4
Joined: Tue May 09, 2023 3:18 pm

[SOLVED] sitnl_send Invalid argument, Linux can't add IP to interface tun2

Post by Domitian » Tue Jun 20, 2023 11:04 pm

The connection works, but the control message sent from the server appears to cause an error of some sort.
Server side:

Code: Select all

Tue Jun 20 18:54:29 2023 us=138900 L030/*REDACTED*:43980 PUSH: Received control message: 'PUSH_REQUEST'
Tue Jun 20 18:54:29 2023 us=138951 L030/*REDACTED*:43980 SENT CONTROL [L030]: 'PUSH_REPLY,route 10.3.0.0 255.255.0.0,route-gateway 10.3.0.1,topology subnet,ping 10,ping-restart 120,ifconfig 10.3.0.30 10.3.0.31,peer-id 0,cipher AES-256-GCM' (status=1)
Client Side:

Code: Select all

2023-06-20 18:54:29 us=139759 UDPv4 READ [224] from [AF_INET]*REDACTED*:1196: P_CONTROL_V1 kid=0 pid=[ #10 ] [ ] pid=6 DATA len=182
2023-06-20 18:54:29 us=139823 PUSH: Received control message: 'PUSH_REPLY,route 10.3.0.0 255.255.0.0,route-gateway 10.3.0.1,topology subnet,ping 10,ping-restart 120,ifconfig 10.3.0.30 10.3.0.31,peer-id 0,cipher AES-256-GCM'
2023-06-20 18:54:29 us=139878 OPTIONS IMPORT: --ifconfig/up options modified
2023-06-20 18:54:29 us=139887 OPTIONS IMPORT: route options modified
2023-06-20 18:54:29 us=139893 OPTIONS IMPORT: route-related options modified
2023-06-20 18:54:29 us=139913 net_route_v4_best_gw query: dst 0.0.0.0
2023-06-20 18:54:29 us=139971 sitnl_send: checking for received messages
2023-06-20 18:54:29 us=139989 sitnl_send: rtnl: received 436 bytes
2023-06-20 18:54:29 us=140020 net_route_v4_best_gw result: via 192.168.1.1 dev enp2s0
2023-06-20 18:54:29 us=140052 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=enp2s0 HWADDR=68:1d:ef:2e:df:a1
2023-06-20 18:54:29 us=141813 TUN/TAP device tun2 opened
2023-06-20 18:54:29 us=141847 do_ifconfig, ipv4=1, ipv6=0
2023-06-20 18:54:29 us=141885 net_iface_mtu_set: mtu 1500 for tun2
2023-06-20 18:54:29 us=141922 sitnl_send: checking for received messages
2023-06-20 18:54:29 us=141935 sitnl_send: rtnl: received 36 bytes
2023-06-20 18:54:29 us=141956 net_iface_up: set tun2 up
2023-06-20 18:54:29 us=142216 sitnl_send: checking for received messages
2023-06-20 18:54:29 us=142381 sitnl_send: rtnl: received 36 bytes
2023-06-20 18:54:29 us=142532 net_addr_v4_add: 10.3.0.30/-1 dev tun2
2023-06-20 18:54:29 us=142720 sitnl_send: checking for received messages
2023-06-20 18:54:29 us=142821 sitnl_send: rtnl: received 52 bytes
2023-06-20 18:54:29 us=142951 sitnl_send: rtnl: generic error (-22): Invalid argument
2023-06-20 18:54:29 us=143034 Linux can't add IP to interface tun2
2023-06-20 18:54:29 us=143152 Exiting due to fatal error
Anyone know what's going on here? The one thing I can find suspicious is the 10.3.0.30/-1, I don't know why the "-1" is there.

EDIT: I removed "topology subnet" from the server configuration and the client connects fine now.

ezoer
OpenVpn Newbie
Posts: 1
Joined: Sun Dec 29, 2024 7:25 am

Re: [SOLVED] sitnl_send Invalid argument, Linux can't add IP to interface tun2

Post by ezoer » Sun Dec 29, 2024 7:37 am

This response is for those who read this post and its solution to disable topology subnet (and revert to topology net30) but would like to use:

Code: Select all

topology subnet
in their OpenVPN Server configurations.

The reason the client configuration triggers an error when configuring a static IP address as follows:

Code: Select all

ifconfig-push 10.8.0.101 10.8.0.102
is because topology subnet expects an IP address and subnet mask to be configured as opposed to two IP addresses as is necessary in the case of the default topology net30. Therefore, when your server is configured with topology subnet, use the following client configuration to push an IP address:

Code: Select all

ifconfig-push <IP address> <subnet mask>
For example:

Code: Select all

ifconfig-push 10.8.0.100 255.255.255.0
Make sure that the IP address is assigned in a routable network on the VPN server. If you just want to assign static IP addresses, use the default server subnet for clients.

xenovas
OpenVpn Newbie
Posts: 2
Joined: Mon May 05, 2025 4:35 am

Re: [SOLVED] sitnl_send Invalid argument, Linux can't add IP to interface tun2

Post by xenovas » Mon May 05, 2025 4:48 am

@ezoer Finally someone has the question I wanted to ask right now.. Thank you for the solution you found and fixed. I will try it now..

Post Reply