OpenWrt Forum Archive

Topic: Multiple OpenVPN instances and firewall

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

I have a server on lan interface eth1 of openwrt router.  I don't know access web on this server from laptop that connected to VPN on openwrt router.
Here is all my  configs
laptop ifconfig

eth0      Link encap:Ethernet  HWaddr 00:1d:72:d2:36:a2 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1     
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000                       
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)             
          Interrupt:16                                       

eth0:1    Link encap:Ethernet  HWaddr 00:1d:72:d2:36:a2 
          inet addr:192.168.250.2  Bcast:192.168.250.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1                       
          Interrupt:16                                                     

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:16436  Metric:1
          RX packets:24721 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24721 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2571818 (2.4 MiB)  TX bytes:2571818 (2.4 MiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.0.4.6  P-t-P:10.0.4.5  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:268 errors:0 dropped:0 overruns:0 frame:0
          TX packets:304 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:23152 (22.6 KiB)  TX bytes:25488 (24.8 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:21:5d:4c:82:3c
          inet addr:192.168.10.100  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::221:5dff:fe4c:823c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:197699 errors:0 dropped:0 overruns:0 frame:0
          TX packets:215511 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:157616156 (150.3 MiB)  TX bytes:42811054 (40.8 MiB)

wmaster0  Link encap:UNSPEC  HWaddr 00-21-5D-4C-82-3C-00-00-00-00-00-00-00-00-00-00
          UP RUNNING  MTU:0  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
</code>

Openwrt router ifconfig

eth0      Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A 
          inet addr:195.168.11.4  Bcast:195.168.11.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1             
          RX packets:2878 errors:0 dropped:0 overruns:0 frame:0           
          TX packets:1844 errors:0 dropped:0 overruns:0 carrier:0         
          collisions:0 txqueuelen:100                                     
          RX bytes:196485 (191.8 KiB)  TX bytes:254617 (248.6 KiB)       

eth0:1    Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A 
          inet addr:195.168.11.9  Bcast:195.168.11.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1             

eth1      Link encap:Ethernet  HWaddr 00:D0:12:00:E6:2B
          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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:402 (402.0 B)

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:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1230 (1.2 KiB)  TX bytes:1230 (1.2 KiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.0.8.1  P-t-P:10.0.8.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

tun2      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.0.4.1  P-t-P:10.0.4.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:166 errors:0 dropped:0 overruns:0 frame:0
          TX packets:195 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:13920 (13.5 KiB)  TX bytes:16532 (16.1 KiB)

laptop openvpn conf

dev tun
port 1196
verb 5
comp-lzo
keepalive       10      30
daemon
status          /etc/openvpn/openvpn.status.client
log-append      /etc/openvpn/openvpn.log.client
ca              /etc/openvpn/ca.crt
cert            /etc/openvpn/roadwarrior.crt
key             /etc/openvpn/roadwarrior.key
persist-key
persist-tun
client
remote 195.168.11.4 1196
pull

Openwrt server.conf

proto udp
dev tun0
port 1194
                verb 6
                comp-lzo
                keepalive       10      30
                daemon
                status          /etc/openvpn/openvpn.status
                log-append      /etc/openvpn/openvpn.log
                local           195.168.11.4
                mode            server
                server          10.0.8.0        255.255.252.0
                ca              /etc/easy-rsa/keys/ca.crt
                cert            /etc/easy-rsa/keys/gameserver-router-master-serverfarma.nethouse-intra.sk.crt
                key             /etc/easy-rsa/keys/gameserver-router-master-serverfarma.nethouse-intra.sk.key
                dh              /root/game/dh1024.pem
                ;dh             /etc/easy-rsa/keys/dh1024.pem
                persist-key
                persist-tun
                client-to-client
                client-config-dir /etc/openvpn/ccd
                route 10.0.8.0 255.255.252.0
                ;push "redirect-gateway"
                push "route 192.168.1.0 255.255.255.0"
                tls-server

Openwrt server2.conf

proto udp
dev tun2
port 1196
                verb 6
                comp-lzo
                keepalive       10      30
                daemon
                status          /etc/openvpn/openvpn.status.server2
                log-append      /etc/openvpn/openvpn.log.server2
                local           195.168.11.4
                mode            server
                server          10.0.4.0        255.255.252.0
                ca              /etc/easy-rsa/keys/ca.crt
                cert            /etc/easy-rsa/keys/gameserver-router-master-serverfarma.nethouse-intra.sk.crt
                key             /etc/easy-rsa/keys/gameserver-router-master-serverfarma.nethouse-intra.sk.key
                dh              /root/game/dh1024.pem
                ;dh             /etc/easy-rsa/keys/dh1024.pem
                persist-key
                persist-tun
                client-to-client
                client-config-dir /etc/openvpn/ccd
                route 10.0.4.0 255.255.252.0
                ;push "redirect-gateway"
                push "route 192.168.1.0 255.255.255.0"
                tls-server
                duplicate-cn

Openwrt client.conf
proto udp
dev tun1
port 1195
verb 0
comp-lzo
keepalive       10      30
daemon
status          /etc/openvpn/openvpn.status.gameserver-router-master-serverfarma.nethouse-intra.sk
log-append      /etc/openvpn/openvpn.log.gameserver-router-master-serverfarma.nethouse-intra.sk
ca              /etc/openvpn/ca.crt
cert            /etc/openvpn/gameserver-router-master-serverfarma.nethouse-intra.sk.client.crt
key             /etc/openvpn/gameserver-router-master-serverfarma.nethouse-intra.sk.client.key
persist-key
persist-tun
client
remote gameserver-router-slave-serverfarma 1195
pull

Openwrt network conf

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

config 'interface' 'lan'
option 'ifname' 'eth1'
option 'proto' 'static'
option 'ipaddr' '192.168.1.1'
option 'netmask' '255.255.255.0'

config 'interface' 'wan'
option 'ifname' 'eth0'
option 'proto' 'static'
option 'ipaddr' '195.168.11.4'
option 'netmask' '255.255.255.0'
option 'gateway' '195.168.11.1'
option 'dns' '213.215.116.99'

config 'interface' 'vpn'
option 'ifname' 'tun+'
option 'proto' 'none'
option 'auto' 'disable'
option 'defaultroute' '0'
option 'peerdns' '0'

config 'alias'
option 'interface' 'wan'
option 'proto' 'static'
option 'ipaddr' '195.168.11.9'
option 'netmask' '255.255.255.0'

Openwrt firewall conf

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

config zone
        option name             lan
        option input    ACCEPT
        option output   ACCEPT
        option forward  REJECT

config zone
        option name             wan
        option input    REJECT
        option output   ACCEPT
        option forward  REJECT
        option masq             1

config forwarding
        option src      lan
        option dest     wan
        option mtu_fix  1

# include a file with users custom iptables rules
config include
        option path /etc/firewall.user

config rule
        option src              wan
        option dest_port        22
        option proto             tcp
        option target            ACCEPT

config 'rule'
        option 'name' 'OpenVPN1'
        option 'src' 'wan'
        option 'target' 'ACCEPT'
        option 'proto' 'udp'
        option 'dest_port' '1194'

config 'rule'
        option 'name' 'OpenVPN2'
        option 'src' 'wan'
        option 'target' 'ACCEPT'
        option 'proto' 'udp'
        option 'dest_port' '1195'

config 'rule'
        option 'name' 'OpenVPN3'
        option 'src' 'wan'
        option 'target' 'ACCEPT'
        option 'proto' 'udp'
        option 'dest_port' '1196'

config 'zone'
        option 'name' 'vpn'
        option 'input' 'ACCEPT'
        option 'output' 'ACCEPT'
        option 'forward' 'ACCEPT'
        option 'network' 'vpn'

config 'forwarding'
        option 'src' 'lan'
        option 'dest' 'vpn'
        option 'forward' 'ACCEPT'

config 'forwarding'
        option 'src' 'vpn'
        option 'dest' 'lan'
        option 'forward' 'ACCEPT'

All routing tables is OK. I know ping from laptop to 192.168.1.1, openwrt router lan interface over vpn tunnel, but don't know access to 192.168.1.2 server
that connected to lan interface on openwrt router. Where is a problem?
Please help me

Thank's

Rony

If I stopping firewall, then all OK. What is bad on my firewall config?

Thank's

Rony

The discussion might have continued from here.