OpenWrt Forum Archive

Topic: OpenVPN not working

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi everybody,

I have a WRT54G and I installed:

OpenWrt Firmware
Kamikaze (r14417)
Using Kernel 2.4 (brcm-2.4)

I tried to get openvpn to work... but I somehow get the error message:

Tue Jun 23 00:33:17 2009 Note: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Tue Jun 23 00:33:17 2009 Note: Attempting fallback to kernel 2.2 TUN/TAP interface
Tue Jun 23 00:33:17 2009 Cannot allocate TUN/TAP dev dynamically
Tue Jun 23 00:33:17 2009 Exiting

lsmod shows:

Module                  Size  Used by    Tainted: P
wlcompat                9504   0 (unused)
ip_conntrack_tftp       1724   0 (unused)
ip_nat_irc              2360   0 (unused)
ip_conntrack_irc        3140   1
ip_nat_ftp              2984   0 (unused)
ip_conntrack_ftp        4284   1
ipt_MASQUERADE          1316   3
iptable_nat            21000   3 [ip_nat_irc ip_nat_ftp ipt_MASQUERADE]
ipt_state                408   6
ip_conntrack           22640   3 [ip_conntrack_tftp ip_nat_irc ip_conntrack_irc ip_nat_ftp ip_conntrack_ftp ipt_MASQUERADE iptable_nat ipt_state]
ipt_REJECT              3932   2
ipt_TCPMSS              2316   3
ipt_LOG                 3804   0 (unused)
ipt_multiport            748   0 (unused)
ipt_mac                  556   0 (unused)
ipt_limit                892   1
iptable_mangle          2156   0 (unused)
iptable_filter          1676   1
ip_tables              16960  13 [ipt_MASQUERADE iptable_nat ipt_state ipt_REJECT ipt_TCPMSS ipt_LOG ipt_multiport ipt_mac ipt_limit iptable_mangle iptable_filter]
ppp_async               8044   0 (unused)
wl                    666560   0 (unused)
pppoe                   9320   1
pppox                   1196   1 [pppoe]
ppp_generic            22380   3 [ppp_async pppoe pppox]
slhc                    6064   0 [ppp_generic]
switch-robo             5084   0 (unused)
switch-core             5104   0 [switch-robo]
diag                   48752   0 (unused)

and ifconfig:

br-dmz    Link encap:Ethernet  HWaddr 00:23:69:25:AC:20
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:402 (402.0 B)

br-lan    Link encap:Ethernet  HWaddr 00:23:69:25:AC:20
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:426 errors:0 dropped:0 overruns:0 frame:0
          TX packets:514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:43269 (42.2 KiB)  TX bytes:283582 (276.9 KiB)

eth0      Link encap:Ethernet  HWaddr 00:23:69:25:AC:20
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1209 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1247 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:341932 (333.9 KiB)  TX bytes:352933 (344.6 KiB)
          Interrupt:4

eth0.0    Link encap:Ethernet  HWaddr 00:23:69:25:AC:20
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:424 errors:0 dropped:0 overruns:0 frame:0
          TX packets:514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:44849 (43.7 KiB)  TX bytes:285638 (278.9 KiB)

eth0.1    Link encap:Ethernet  HWaddr 00:23:69:25:AC:20
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:406 (406.0 B)

eth0.2    Link encap:Ethernet  HWaddr 00:23:69:25:AC:20
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:738 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:275901 (269.4 KiB)  TX bytes:50141 (48.9 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:179 (179.0 B)  TX bytes:179 (179.0 B)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:XX.XX.XX.XX  P-t-P:195.14.247.165  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:321 errors:0 dropped:0 overruns:0 frame:0
          TX packets:266 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:248495 (242.6 KiB)  TX bytes:27106 (26.4 KiB)

wl0       Link encap:Ethernet  HWaddr 00:23:69:25:AC:22
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:1567
          TX packets:0 errors:1 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:2 Base address:0x5000

Well I don't know what to do... I reinstalled openvpn already a couple of times... why is there no tun interface?

Thanks for any help!

kmod-tun is not installed or insmod tun is missing.

Well how do I install it?

root@Router:~# opkg install kmod-tun
Package kmod-tun (2.6.25.17-brcm47xx-1) installed in root is up to date.

tells me it is installed... so is openvpn

root@Router:~# opkg install openvpn
Package openvpn (2.0.9-5) installed in root is up to date.

I also added the following configs:

network.vpn=interface
network.vpn.ifname=tun0
network.vpn.proto=none
network.vpn.ipaddr=1.2.3.4
network.vpn.netmask=255.255.255.0
firewall.@zone[3]=zone
firewall.@zone[3].name=vpn
firewall.@zone[3].input=ACCEPT
firewall.@zone[3].output=ACCEPT
firewall.@zone[3].forward=REJECT
openvpn.custom_config=openvpn
openvpn.custom_config.enable=0
openvpn.custom_config.config=/etc/openvpn/server.conf
openvpn.sample_server=openvpn
openvpn.sample_server.enable=1
openvpn.sample_server.port=1194
openvpn.sample_server.proto=udp
openvpn.sample_server.dev=tun
openvpn.sample_server.ca=/etc/openvpn/ca.crt
openvpn.sample_server.cert=/etc/openvpn/server.crt
openvpn.sample_server.key=/etc/openvpn/server.key
openvpn.sample_server.dh=/etc/openvpn/dh.pem
openvpn.sample_server.server=10.8.0.0 255.255.255.0
openvpn.sample_server.ifconfig_pool_persist=ipp.txt
openvpn.sample_server.keepalive=10 120
openvpn.sample_server.comp_lzo=1
openvpn.sample_server.persist_key=1
openvpn.sample_server.persist_tun=1
openvpn.sample_server.status=openvpn-status.log
openvpn.sample_server.verb=3
openvpn.sample_client=openvpn
openvpn.sample_client.enable=0
openvpn.sample_client.client=1
openvpn.sample_client.dev=tun
openvpn.sample_client.proto=udp
openvpn.sample_client.remote=my_server_1 1194
openvpn.sample_client.resolv_retry=infinite
openvpn.sample_client.nobind=1
openvpn.sample_client.persist_key=1
openvpn.sample_client.persist_tun=1
openvpn.sample_client.ca=ca.crt
openvpn.sample_client.cert=client.crt
openvpn.sample_client.key=client.key
openvpn.sample_client.comp_lzo=1
openvpn.sample_client.verb=3

I just saw that you wrote something about insmod... I tried that too:

root@Router:/etc/config# insmod tun
insmod: Loading module failed: No such file or directory

What is wrong sad... I'm not an expert and I'm sooo lost!

So I also tried this:

root@Router:/etc/config# ls /lib/modules/2.4.35.4/
diag.o               ipt_REJECT.o         ppp_generic.o
ip_conntrack.o       ipt_TCPMSS.o         pppoe.o
ip_conntrack_ftp.o   ipt_limit.o          pppox.o
ip_conntrack_irc.o   ipt_mac.o            slhc.o
ip_conntrack_tftp.o  ipt_multiport.o      switch-adm.o
ip_nat_ftp.o         ipt_state.o          switch-core.o
ip_nat_irc.o         iptable_filter.o     switch-robo.o
ip_tables.o          iptable_mangle.o     wl.o
ipt_LOG.o            iptable_nat.o        wlcompat.o
ipt_MASQUERADE.o     ppp_async.o
root@Router:/etc/config# ls /lib/modules/2.6.25.17/tun.ko

Is that the wrong version of the kernel 2.6? Could that be the problem? How can I fix that? As mentioned I'm not an expert... I'm close to the noob status!

(Last edited by Jogilein on 23 Jun 2009, 18:25)

Same issue here. Kamikaze (brcm-2.4) on a WRT54G v4.

# uname -a
Linux blink-vpn01 2.4.35.4 #12 Mon Jun 1 21:52:49 UTC 2009 mips unknown

# opkg install kmod-tun
Package kmod-tun (2.6.25.20-brcm47xx-1) installed in root is up to date.

# opkg install openvpn
Package openvpn (2.0.9-5.1) installed in root is up to date.

# insmod tun
insmod: Loading module failed: No such file or directory

# openvpn <valid config file>
<successful link/control connection to OpenVPN server>
Sun May 31 13:41:59 2009 Note: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Sun May 31 13:41:59 2009 Note: Attempting fallback to kernel 2.2 TUN/TAP interface
Sun May 31 13:41:59 2009 Cannot allocate TUN/TAP dev dynamically
Sun May 31 13:41:59 2009 Exiting

# ls /lib/modules/*
/lib/modules/2.4.35.4:
diag.o               ipt_LOG.o            iptable_filter.o     switch-adm.o
ip_conntrack.o       ipt_MASQUERADE.o     iptable_mangle.o     switch-core.o
ip_conntrack_ftp.o   ipt_REJECT.o         iptable_nat.o        switch-robo.o
ip_conntrack_irc.o   ipt_TCPMSS.o         ppp_async.o          wl.o
ip_conntrack_tftp.o  ipt_limit.o          ppp_generic.o        wlcompat.o
ip_nat_ftp.o         ipt_mac.o            pppoe.o
ip_nat_irc.o         ipt_multiport.o      pppox.o
ip_tables.o          ipt_state.o          slhc.o

/lib/modules/2.6.25.20:
tun.ko

(Last edited by jlg89 on 3 Jul 2009, 14:37)

Figured it out.

When I first installed OpenWrt on this WRT54G, I tried the brcm47xx version, which didn't work for various reasons (mainly the fact that wireless didn't work). So, I used the LuCI interface to flash brcm-2.4 onto it. Looking at my software, I realized that I was still running the 2.6 kernel with 2.4 supporting files. After a second flashing of brcm-2.4, the kernel is now at 2.4 as it should be.

However, one problem still remained--the package source was still pointing at the brcm47xx package directory.

In LuCI, go to System-->Software and click "Edit package lists and installation targets" (or, via ssh, edit /etc/opkg.conf), and change the line that reads

src/gz snapshots http://downloads.openwrt.org/kamikaze/8 … x/packages

to

src/gz snapshots http://downloads.openwrt.org/kamikaze/8 … 4/packages

Save changes, go back to the System-->Software screen, and "Update package lists" (or, via ssh, run opkg update). Now you should be able to install and successfully run kmod-tun and openvpn.

The discussion might have continued from here.