TUN device not available

Hi,

I just installed OpenWrt 19.07.2 on my Archer C7 (V2) EU router. I'm trying to set up OpenVPN with NordVPN, but I get an error: You must define TUN/TAP device.

My setup is: ISP modem -> Router1 (192.168.1.1) -> OpenWrt Router (192.168.0.1) -> PC/Phone

The OpenWrt router works fine, but OpenVPN/NordVPN does not.

In LuCI, the NordVPN interface says: Network device is not present:

I followed NordVPN's guide. I created the file 'NordVPN.auth' in the folder '/etc/openvpn'. The file only contains two lines: line 1 has my NordVPN user name and line 2 has my NordVPN password.

The folder '/etc/openvpn' only contains two files:
in57.nordvpn.com.udp.ovpn
NordVPN.auth

This is the content of my configuration files:
/etc/openvpn/in57.nordvpn.com.udp.ovpn:


client
dev-type tun
proto udp
remote 165.231.253.99 1194
resolv-retry infinite
remote-random
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0
comp-lzo no

remote-cert-tls server

auth-user-pass /etc/openvpn/NordVPN.auth
verb 3
pull
fast-io
cipher AES-256-CBC
auth SHA512
<ca>
-----BEGIN CERTIFICATE-----
MIIFCjCCAvKgAwIBAgIBATANBgkqhkiG9w0BAQ0FADA5MQswCQYDVQQGEwJQQTEQ
MA4GA1UEChMHTm9yZFZQTjEYMBYGA1UEAxMPTm9yZFZQTiBSb290IENBMB4XDTE2
MDEwMTAwMDAwMFoXDTM1MTIzMTIzNTk1OVowOTELMAkGA1UEBhMCUEExEDAOBgNV
BAoTB05vcmRWUE4xGDAWBgNVBAMTD05vcmRWUE4gUm9vdCBDQTCCAiIwDQYJKoZI
hvcNAQEBBQADggIPADCCAgoCggIBAMkr/BYhyo0F2upsIMXwC6QvkZps3NN2/eQF
kfQIS1gql0aejsKsEnmY0Kaon8uZCTXPsRH1gQNgg5D2gixdd1mJUvV3dE3y9FJr
XMoDkXdCGBodvKJyU6lcfEVF6/UxHcbBguZK9UtRHS9eJYm3rpL/5huQMCppX7kU
eQ8dpCwd3iKITqwd1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tPKoHc9mDpRdNPISeVa
wDBM1mJChneHt59Nh8Gah74+TM1jBsw4fhJPvoc7Atcg740JErb904mZfkIEmojC
VPhBHVQ9LHBAdM8qFI2kRK0IynOmAZhexlP/aT/kpEsEPyaZQlnBn3An1CRz8h0S
PApL8PytggYKeQmRhl499+6jLxcZ2IegLfqq41dzIjwHwTMplg+1pKIOVojpWA==
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
e685bdaf659a25a200e2b9e39e51ff03
0fc72cf1ce07232bd8b2be5e6c670143
f51e937e670eee09d4f2ea5a6e4e6996
5db852c275351b86fc4ca892d78ae002
d6f70d029bd79c4d1c26cf14e9588033
cf639f8a74809f29f72b9d58f9b8f5fe
fc7938eade40e9fed6cb92184abb2cc1
0eb1a296df243b251df0643d53724cdb
5a92a1d6cb817804c4a9319b57d53be5
80815bcfcb2df55018cc83fc43bc7ff8
2d51f9b88364776ee9d12fc85cc7ea5b
9741c4f598c485316db066d52db4540e
212e1518a9bd4828219e24b20d88f598
a196c9de96012090e333519ae18d3509
9427e7b372d348d352dc4c85e18cd4b9
3f8a56ddb2e64eb67adfc9b337157ff4
-----END OpenVPN Static key V1----
</tls-auth>

/etc/config/network:


config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd73:825b:d8a5::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth1.1'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.0.1'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'dhcp'
        option force_link '1'
	option peerdns '0'
	list dns '103.86.96.100'
	list dns '103.86.99.100'

config interface 'wan6'
	option ifname 'eth0.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '2 3 4 5 0t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '1 6t'

config interface 'nordvpntun'
	option proto 'none'
        option ifname 'tun0'
        option auto '1'

/etc/config/firewall:


config defaults
	option syn_flood '1'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'

config zone
	option name 'lan'
	list network 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone
	option name 'wan'
	list network 'wan'
	list network 'wan6'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'

config forwarding
	option src 'lan'
	option dest 'wan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option src_ip 'fc00::/6'
	option dest_ip 'fc00::/6'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

config include
	option path '/etc/firewall.user'

config zone
	option name 'vpnfirewall'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	list network 'nordvpntun'

config forwarding
	option src 'lan'
	option dest 'vpnfirewall'

/etc/config/OpenVPN:


config openvpn 'custom_config'
	option enabled '0'
	option config '/etc/openvpn/in57.nordvpn.com.udp.ovpn'

config openvpn 'sample_server'
	option enabled '0'
	option port '1194'
	option proto 'udp'
	option dev 'tun'
	option ca '/etc/openvpn/ca.crt'
	option cert '/etc/openvpn/server.crt'
	option key '/etc/openvpn/server.key'
	option dh '/etc/openvpn/dh1024.pem'
	option server '10.8.0.0 255.255.255.0'
	option ifconfig_pool_persist '/tmp/ipp.txt'
	option keepalive '10 120'
	option compress 'lzo'
	option persist_key '1'
	option persist_tun '1'
	option user 'nobody'
	option status '/tmp/openvpn-status.log'
	option verb '3'

config openvpn 'sample_client'
	option enabled '0'
	option client '1'
	option dev 'tun'
	option proto 'udp'
	list remote 'my_server_1 1194'
	option resolv_retry 'infinite'
	option nobind '1'
	option persist_key '1'
	option persist_tun '1'
	option user 'nobody'
	option ca '/etc/openvpn/ca.crt'
	option cert '/etc/openvpn/client.crt'
	option key '/etc/openvpn/client.key'
	option compress 'lzo'
	option verb '3'

config openvpn 'nordvpn'
	option enabled '1'
	option config '/etc/openvpn/in57.nordvpn.com.udp.ovpn'

Result of ifconfig (HWaddr and inet addr have been masked):

br-lan    Link encap:Ethernet  HWaddr ??:??:??:??:??:??  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: ????::????:????:????:????/64 Scope:Link
          inet6 addr: ????:????:????::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7263 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7444 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1012805 (989.0 KiB)  TX bytes:5718816 (5.4 MiB)

eth0      Link encap:Ethernet  HWaddr ??:??:??:??:??:??   
          inet6 addr: ????::????:????:????:????/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4860 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3723 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3791989 (3.6 MiB)  TX bytes:611170 (596.8 KiB)
          Interrupt:4 

eth0.2    Link encap:Ethernet  HWaddr ??:??:??:??:??:??   
          inet addr:192.168.1.121  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: ????::????:????:????:????/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4860 errors:0 dropped:19 overruns:0 frame:0
          TX packets:3715 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3704509 (3.5 MiB)  TX bytes:595414 (581.4 KiB)

eth1      Link encap:Ethernet  HWaddr ??:??:??:??:??:??   
          inet6 addr: ????::????:????:????:????/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2639 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:272773 (266.3 KiB)
          Interrupt:5 

eth1.1    Link encap:Ethernet  HWaddr ??:??:??:??:??:??   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2619 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:260325 (254.2 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1551 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1551 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:135576 (132.3 KiB)  TX bytes:135576 (132.3 KiB)

wlan0     Link encap:Ethernet  HWaddr ??:??:??:??:??:??   
          inet6 addr: ????::????:????:????:????/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7339 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9997 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1118965 (1.0 MiB)  TX bytes:6170187 (5.8 MiB)

wlan1     Link encap:Ethernet  HWaddr ??:??:??:??:??:??  
          inet6 addr: ????::????:????:????:????/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2612 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:305927 (298.7 KiB)


Result of logread -e openvpn:

Sat Apr 11 12:40:11 2020 daemon.err openvpn(nordvpn)[2544]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:11 2020 daemon.warn openvpn(nordvpn)[2544]: Use --help for more information.
Sat Apr 11 12:40:16 2020 daemon.err openvpn(nordvpn)[2548]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:16 2020 daemon.warn openvpn(nordvpn)[2548]: Use --help for more information.
Sat Apr 11 12:40:21 2020 daemon.err openvpn(nordvpn)[2551]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:21 2020 daemon.warn openvpn(nordvpn)[2551]: Use --help for more information.
Sat Apr 11 12:40:27 2020 daemon.err openvpn(nordvpn)[2557]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:27 2020 daemon.warn openvpn(nordvpn)[2557]: Use --help for more information.
Sat Apr 11 12:40:32 2020 daemon.err openvpn(nordvpn)[2560]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:32 2020 daemon.warn openvpn(nordvpn)[2560]: Use --help for more information.
Sat Apr 11 12:40:37 2020 daemon.err openvpn(nordvpn)[2564]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:37 2020 daemon.warn openvpn(nordvpn)[2564]: Use --help for more information.
Sat Apr 11 12:40:42 2020 daemon.err openvpn(nordvpn)[2568]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:42 2020 daemon.warn openvpn(nordvpn)[2568]: Use --help for more information.
Sat Apr 11 12:40:47 2020 daemon.err openvpn(nordvpn)[2571]: Options error: You must define TUN/TAP device (--dev)
Sat Apr 11 12:40:47 2020 daemon.warn openvpn(nordvpn)[2571]: Use --help for more information.
opkg list-installed | grep tun

Hi wulfy23,

When I run that command, I get this: kmod-tun - 4.14.171-1

Thanks

Best to comment out the sample server section... ( add # at start of all lines ) then change enabled to 1 in your config section.

Hi wulfy23,

Thanks for taking the time to help out. The file '/etc/config/openvpn' now looks like this (go to the bottom of the file), and the TUN device is still not available.


#config openvpn 'custom_config'
#	option enabled '1'
#	option config '/etc/openvpn/in57.nordvpn.com.udp.ovpn'

#config openvpn 'sample_server'
#	option enabled '0'
#	option port '1194'
#	option proto 'udp'
#	option dev 'tun'
#	option ca '/etc/openvpn/ca.crt'
#	option cert '/etc/openvpn/server.crt'
#	option key '/etc/openvpn/server.key'
#	option dh '/etc/openvpn/dh1024.pem'
#	option server '10.8.0.0 255.255.255.0'
#	option ifconfig_pool_persist '/tmp/ipp.txt'
#	option keepalive '10 120'
#	option compress 'lzo'
#	option persist_key '1'
#	option persist_tun '1'
#	option user 'nobody'
#	option status '/tmp/openvpn-status.log'
#	option verb '3'

#config openvpn 'sample_client'
#	option enabled '0'
#	option client '1'
#	option dev 'tun'
#	option proto 'udp'
#	list remote 'my_server_1 1194'
#	option resolv_retry 'infinite'
#	option nobind '1'
#	option persist_key '1'
#	option persist_tun '1'
#	option user 'nobody'
#	option ca '/etc/openvpn/ca.crt'
#	option cert '/etc/openvpn/client.crt'
#	option key '/etc/openvpn/client.key'
#	option compress 'lzo'
#	option verb '3'

config openvpn 'nordvpn'
	option enabled '1'
	option config '/etc/openvpn/in57.nordvpn.com.udp.ovpn'


in /etc/config/network try commenting out the last line

# option auto '1'

Hi wulfy23,

I've made the changes, and restarted the router. TUN device is still missing. In /etc/config/openvpn, I now have both custom config and nordvpn config - both pointing to the same server and both enabled. Is that how it should be?

sorry i didn't see your section at the bottom... that bottom bit only is all you need.

yeah... not seeing anything obvious... was pretty sure you don't need "ip-full" package...

by any chance did you edit the .ovpn with a windows text editor or something?

I did edit the .ovpn file with notepad in windows. should I try to download the file again, and then connect to the router with putty and edit the file?

1 Like

Yeah... keep the zip for later. Redo the .ovpn... then use nano or vim to check the other files... ( redo the auth file too ) ...

I think with notepad... you have to select save as UTF-8... but it's safer to just edit on the router ( good skill to have )

1 Like

Hi wulfy23,

Success!!!! I downloaded the file again, and copied it (untouched) to the router, did the modifications there, and now it works :slight_smile:

Thank you so much for your help

winner ! :robot: good job.

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