Re: [Solved]Followed OpenWRT tutorials OpenWRT refuse connec
Posted: Fri Mar 27, 2015 1:12 am
and Michael still found a work around .. 

Community Support Forum
https://forums.openvpn.net/
I think you have this wrong ..JW0914 wrote:If WAN traffic comes in on 1194 and is then forwarded direct to LAN on 1194, then the traffic is completely bypassing the VPN Zone and tun0 interface (or do I have this wrong)?
Possibly .. but I tried a backup AA / restore to BB = Brick (not surprising) restore settings at your own risk !JW0914 wrote:if I add the iptables rules as shown in AA that I may be able to get the VPN to work with the local directive?
Bit of both ..JW0914 wrote:is it having the local directive worth it? Is there a security reason for it, or is it just user preference?
The WRT 1900ac is only compatible with Chaos Calmer (it was only 3 months ago that Linksys [Belkin] finally released the opensource radio drivers (only a year after launch).Traffic wrote:Possibly .. but I tried a backup AA / restore to BB = Brick (not surprising) restore settings at your own risk !
I would prefer it to be on the LAN as well. For advanced firewall rules, I prefer uci to be able to use iptables, and will try adding the AA rule tonight to see if it makes a differenceTraffic wrote:I suspect, if you NAT correctly to the internet you should be ok .. but I would prefer it be on the LAN not WAN.
I am sure there must be a way to configure using openwrt GUI to do a port-forward (not a port redirect).
https://www.frozentux.net/iptables-tuto ... RECTTARGETNote that the REDIRECT target is only valid within the PREROUTING and OUTPUT chains of the nat table. It is also valid within user-defined chains that are only called from those chains, and nowhere else. The REDIRECT target takes only one option, as described below.
BB: Network=Firewall=Port.Forwards != PortForward and cannot due to limitation of iptables.Table 11-13. REDIRECT target options
- Option --to-ports
Code: Select all
root@OpenWrt22:~# iptables-save|grep 640 # same as before
-A PREROUTING -i eth1 -p udp -m udp --dport 64022 -j DNAT --to-destination 10.1.101.22:64022
-A zone_wan_prerouting -p udp -m comment --comment OVPN-PFWD-U64022 -j REDIRECT --to-ports 64022
-A FORWARD -d 10.1.101.22/32 -p udp -m udp --dport 64022 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
root@OpenWrt22:~#
Code: Select all
root@OpenWrt22:~#
root@OpenWrt22:~# uci show
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded=1
dhcp.@dnsmasq[0].boguspriv=1
dhcp.@dnsmasq[0].filterwin2k=0
dhcp.@dnsmasq[0].localise_queries=1
dhcp.@dnsmasq[0].rebind_protection=1
dhcp.@dnsmasq[0].rebind_localhost=1
dhcp.@dnsmasq[0].local=/lan/
dhcp.@dnsmasq[0].domain=lan
dhcp.@dnsmasq[0].expandhosts=1
dhcp.@dnsmasq[0].nonegcache=0
dhcp.@dnsmasq[0].authoritative=1
dhcp.@dnsmasq[0].readethers=1
dhcp.@dnsmasq[0].leasefile=/tmp/dhcp.leases
dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
dhcp.lan=dhcp
dhcp.lan.interface=lan
dhcp.lan.start=100
dhcp.lan.limit=150
dhcp.lan.leasetime=12h
dhcp.wan=dhcp
dhcp.wan.interface=wan
dhcp.wan.ignore=1
dropbear.@dropbear[0]=dropbear
dropbear.@dropbear[0].PasswordAuth=on
dropbear.@dropbear[0].Interface=lan
dropbear.@dropbear[0].Port=22
firewall.@rule[0]=rule
firewall.@rule[0].name=Allow-DHCP-Renew
firewall.@rule[0].src=wan
firewall.@rule[0].proto=udp
firewall.@rule[0].dest_port=68
firewall.@rule[0].target=ACCEPT
firewall.@rule[0].family=ipv4
firewall.@rule[1]=rule
firewall.@rule[1].name=Allow-Ping
firewall.@rule[1].src=wan
firewall.@rule[1].proto=icmp
firewall.@rule[1].icmp_type=echo-request
firewall.@rule[1].family=ipv4
firewall.@rule[1].target=ACCEPT
firewall.@rule[2]=rule
firewall.@rule[2].name=Allow-DHCPv6
firewall.@rule[2].src=wan
firewall.@rule[2].proto=udp
firewall.@rule[2].src_ip=fe80::/10
firewall.@rule[2].src_port=547
firewall.@rule[2].dest_ip=fe80::/10
firewall.@rule[2].dest_port=546
firewall.@rule[2].family=ipv6
firewall.@rule[2].target=ACCEPT
firewall.@rule[3]=rule
firewall.@rule[3].name=Allow-ICMPv6-Input
firewall.@rule[3].src=wan
firewall.@rule[3].proto=icmp
firewall.@rule[3].icmp_type=echo-request echo-reply destination-unreachable packet-too-big time-exceeded bad-header unknown-header-type router-solicitation neighbour-solicitation router-advertisement neighbour-advertisement
firewall.@rule[3].limit=1000/sec
firewall.@rule[3].family=ipv6
firewall.@rule[3].target=ACCEPT
firewall.@rule[4]=rule
firewall.@rule[4].name=Allow-ICMPv6-Forward
firewall.@rule[4].src=wan
firewall.@rule[4].dest=*
firewall.@rule[4].proto=icmp
firewall.@rule[4].icmp_type=echo-request echo-reply destination-unreachable packet-too-big time-exceeded bad-header unknown-header-type
firewall.@rule[4].limit=1000/sec
firewall.@rule[4].family=ipv6
firewall.@rule[4].target=ACCEPT
firewall.@rule[5]=rule
firewall.@rule[5].target=ACCEPT
firewall.@rule[5].src=wan
firewall.@rule[5].proto=udp
firewall.@rule[5].dest_port=64022
firewall.@rule[5].name=OVPN_OPEN
firewall.@rule[5].family=ipv4
firewall.@rule[5].dest=wan
firewall.@rule[5].dest_ip=172.17.2.22
firewall.@rule[5].enabled=0
firewall.@rule[6]=rule
firewall.@rule[6].name=OVPN_FRWD
firewall.@rule[6].dest_ip=10.1.101.22
firewall.@rule[6].dest_port=64022
firewall.@rule[6].family=ipv4
firewall.@rule[6].proto=udp
firewall.@rule[6].src=*
firewall.@rule[6].dest=*
firewall.@rule[6].target=ACCEPT
firewall.@rule[6].enabled=0
firewall.@defaults[0]=defaults
firewall.@defaults[0].syn_flood=1
firewall.@defaults[0].input=ACCEPT
firewall.@defaults[0].output=ACCEPT
firewall.@defaults[0].forward=ACCEPT
firewall.@zone[0]=zone
firewall.@zone[0].name=lan
firewall.@zone[0].network=lan
firewall.@zone[0].input=ACCEPT
firewall.@zone[0].output=ACCEPT
firewall.@zone[0].family=ipv4
firewall.@zone[0].log=1
firewall.@zone[0].forward=ACCEPT
firewall.@zone[1]=zone
firewall.@zone[1].name=wan
firewall.@zone[1].network=wan
firewall.@zone[1].output=ACCEPT
firewall.@zone[1].mtu_fix=1
firewall.@zone[1].family=ipv4
firewall.@zone[1].log=1
firewall.@zone[1].input=ACCEPT
firewall.@zone[1].forward=ACCEPT
firewall.@include[0]=include
firewall.@include[0].path=/etc/firewall.user
firewall.@redirect[0]=redirect
firewall.@redirect[0].target=DNAT
firewall.@redirect[0].src=wan
firewall.@redirect[0].dest=lan
firewall.@redirect[0].proto=udp
firewall.@redirect[0].dest_ip=10.1.101.22
firewall.@redirect[0].name=OVPN-PFWD-U64022
firewall.@redirect[0].dest_port=64022
firewall.@forwarding[0]=forwarding
firewall.@forwarding[0].dest=lan
firewall.@forwarding[0].src=wan
firewall.@forwarding[1]=forwarding
firewall.@forwarding[1].dest=wan
firewall.@forwarding[1].src=lan
luci.main=core
luci.main.lang=auto
luci.main.resourcebase=/luci-static/resources
luci.main.mediaurlbase=/luci-static/bootstrap
luci.flash_keep=extern
luci.flash_keep.uci=/etc/config/
luci.flash_keep.dropbear=/etc/dropbear/
luci.flash_keep.openvpn=/etc/openvpn/
luci.flash_keep.passwd=/etc/passwd
luci.flash_keep.opkg=/etc/opkg.conf
luci.flash_keep.firewall=/etc/firewall.user
luci.flash_keep.uploads=/lib/uci/upload/
luci.languages=internal
luci.sauth=internal
luci.sauth.sessionpath=/tmp/luci-sessions
luci.sauth.sessiontime=3600
luci.ccache=internal
luci.ccache.enable=1
luci.themes=internal
luci.themes.Bootstrap=/luci-static/bootstrap
network.loopback=interface
network.loopback.ifname=lo
network.loopback.proto=static
network.loopback.ipaddr=127.0.0.1
network.loopback.netmask=255.0.0.0
network.lan=interface
network.lan.ifname=eth0
network.lan.proto=dhcp
network.lan.defaultroute=0
network.lan.delegate=0
network.wan=interface
network.wan.proto=dhcp
network.wan.ifname=eth1
network.wan.delegate=0
openvpn.custom_config=openvpn
openvpn.custom_config.enabled=1
openvpn.custom_config.config=/etc/openvpn/simples/simples22.conf
openvpn.sample_server=openvpn
openvpn.sample_server.enabled=0
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/dh1024.pem
openvpn.sample_server.server=10.8.0.0 255.255.255.0
openvpn.sample_server.ifconfig_pool_persist=/tmp/ipp.txt
openvpn.sample_server.keepalive=10 120
openvpn.sample_server.comp_lzo=yes
openvpn.sample_server.persist_key=1
openvpn.sample_server.persist_tun=1
openvpn.sample_server.status=/tmp/openvpn-status.log
openvpn.sample_server.verb=3
openvpn.sample_client=openvpn
openvpn.sample_client.enabled=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=/etc/openvpn/ca.crt
openvpn.sample_client.cert=/etc/openvpn/client.crt
openvpn.sample_client.key=/etc/openvpn/client.key
openvpn.sample_client.comp_lzo=yes
openvpn.sample_client.verb=3
system.@system[0]=system
system.@system[0].zonename=UTC
system.@system[0].timezone=GMT0
system.@system[0].conloglevel=8
system.@system[0].cronloglevel=8
system.@system[0].hostname=OpenWrt22
system.ntp=timeserver
system.ntp.enabled=1
system.ntp.server=10.1.101.101
ucitrack.@network[0]=network
ucitrack.@network[0].init=network
ucitrack.@network[0].affects=dhcp radvd
ucitrack.@wireless[0]=wireless
ucitrack.@wireless[0].affects=network
ucitrack.@firewall[0]=firewall
ucitrack.@firewall[0].init=firewall
ucitrack.@firewall[0].affects=luci-splash qos miniupnpd
ucitrack.@olsr[0]=olsr
ucitrack.@olsr[0].init=olsrd
ucitrack.@dhcp[0]=dhcp
ucitrack.@dhcp[0].init=dnsmasq
ucitrack.@dropbear[0]=dropbear
ucitrack.@dropbear[0].init=dropbear
ucitrack.@httpd[0]=httpd
ucitrack.@httpd[0].init=httpd
ucitrack.@fstab[0]=fstab
ucitrack.@fstab[0].init=fstab
ucitrack.@qos[0]=qos
ucitrack.@qos[0].init=qos
ucitrack.@system[0]=system
ucitrack.@system[0].init=led
ucitrack.@system[0].affects=luci_statistics
ucitrack.@luci_splash[0]=luci_splash
ucitrack.@luci_splash[0].init=luci_splash
ucitrack.@upnpd[0]=upnpd
ucitrack.@upnpd[0].init=miniupnpd
ucitrack.@ntpclient[0]=ntpclient
ucitrack.@ntpclient[0].init=ntpclient
ucitrack.@samba[0]=samba
ucitrack.@samba[0].init=samba
ucitrack.@tinyproxy[0]=tinyproxy
ucitrack.@tinyproxy[0].init=tinyproxy
uhttpd.main=uhttpd
uhttpd.main.listen_http=0.0.0.0:80
uhttpd.main.listen_https=0.0.0.0:443
uhttpd.main.home=/www
uhttpd.main.rfc1918_filter=1
uhttpd.main.max_requests=3
uhttpd.main.max_connections=100
uhttpd.main.cert=/etc/uhttpd.crt
uhttpd.main.key=/etc/uhttpd.key
uhttpd.main.cgi_prefix=/cgi-bin
uhttpd.main.script_timeout=60
uhttpd.main.network_timeout=30
uhttpd.main.http_keepalive=20
uhttpd.main.tcp_keepalive=1
uhttpd.main.ubus_prefix=/ubus
uhttpd.px5g=cert
uhttpd.px5g.days=730
uhttpd.px5g.bits=1024
uhttpd.px5g.country=DE
uhttpd.px5g.state=Berlin
uhttpd.px5g.location=Berlin
uhttpd.px5g.commonname=OpenWrt
root@OpenWrt22:~#
Code: Select all
eth0 Link encap:Ethernet HWaddr 08:00:27:C7:3D:C3
inet addr:10.1.101.22 Bcast:10.1.101.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fec7:3dc3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25021 errors:0 dropped:0 overruns:0 frame:0
TX packets:25367 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2352906 (2.2 MiB) TX bytes:12881206 (12.2 MiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:7C:58:A2
inet addr:172.17.2.22 Bcast:172.17.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe7c:58a2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3537 errors:0 dropped:0 overruns:0 frame:0
TX packets:1306 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:310351 (303.0 KiB) TX bytes:173020 (168.9 KiB)
Code: Select all
local 10.1.101.22
proto udp
port 64022
Code: Select all
iptables -t nat -A PREROUTING -p udp -i eth1 --dport 64022 -j DNAT --to-destination 10.1.101.22:64022
Code: Select all
root@OpenWrt22:~# uci show firewall.@redirect[0]
firewall.cfg183837=redirect
firewall.cfg183837.target=DNAT
firewall.cfg183837.src=wan
firewall.cfg183837.dest=lan
firewall.cfg183837.proto=udp
firewall.cfg183837.src_dport=64022
firewall.cfg183837.dest_ip=10.1.101.22
firewall.cfg183837.dest_port=64022
firewall.cfg183837.name=OVPN_PFWD_U64022
Code: Select all
root@OpenWrt22:~# /etc/init.d/firewall restart
Warning: Unable to locate ipset utility, disabling ipset support
Warning: Section @redirect[0] (OVPN_PFWD_U64022) refers to a destination address on this router, assuming port redirection
Code: Select all
root@OpenWrt22:~# uci show firewall.@redirect[1]
firewall.cfg1a3837=redirect
firewall.cfg1a3837.target=DNAT
firewall.cfg1a3837.src=wan
firewall.cfg1a3837.dest=lan
firewall.cfg1a3837.proto=udp
firewall.cfg1a3837.src_dport=64023
firewall.cfg1a3837.dest_ip=10.1.101.101
firewall.cfg1a3837.dest_port=64023
firewall.cfg1a3837.name=OVPN_PFWD_U64023
What is .101 pointing to, as in your config is listed as NTP server?This Port Forward rule works:
root@OpenWrt22:~# uci show firewall.@redirect[1]
firewall.cfg1a3837=redirect
firewall.cfg1a3837.target=DNAT
firewall.cfg1a3837.src=wan
firewall.cfg1a3837.dest=lan
firewall.cfg1a3837.proto=udp
firewall.cfg1a3837.src_dport=64023
firewall.cfg1a3837.dest_ip=10.1.101.101
firewall.cfg1a3837.dest_port=64023
firewall.cfg1a3837.name=OVPN_PFWD_U64023
answered your own question thereJW0914 wrote:What is .101 pointing to, as in your config is listed as NTP server?
You listed a forwarding rule to that address... I can't replicate that rule without knowing what it's pointing to. In other words, it's pointing to an interface or device on your network.Traffic wrote:answered your own question thereJW0914 wrote:What is .101 pointing to, as in your config is listed as NTP server?
sure you can .. use a pc on your network.JW0914 wrote:I can't replicate that rule without knowing what it's pointing to
JW0914 wrote: In other words, it's pointing to an interface or device on your network.
Traffic wrote:OpenWRT ifconfig:
Code:Code: Select all
eth0 Link encap:Ethernet HWaddr 08:00:27:C7:3D:C3 inet addr:10.1.101.22 Bcast:10.1.101.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fec7:3dc3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:25021 errors:0 dropped:0 overruns:0 frame:0 TX packets:25367 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2352906 (2.2 MiB) TX bytes:12881206 (12.2 MiB) eth1 Link encap:Ethernet HWaddr 08:00:27:7C:58:A2 inet addr:172.17.2.22 Bcast:172.17.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe7c:58a2/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3537 errors:0 dropped:0 overruns:0 frame:0 TX packets:1306 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:310351 (303.0 KiB) TX bytes:173020 (168.9 KiB)
I interpreted your post to mean that forwarding rule was required to make the local directive work, perhaps that's not what you meant?Traffic wrote:sure you can .. use a pc on your network.
This does appear to be an issue with the way iptables routes data on openwrt, as openwrt (at least with kernel 3.18 on CC) doesn't use an actual iptables configuration file to set rules; it simplifies rule making my taking the rules set within the gui and applies them retroactively, flushing all iptables values upon router reboot or firewall restart (which is why all custom iptables commands must be saved in the firewall.user file which is applied every time the firewall is started or restarted).
Sun Mar 29 14:30:16 2015 read UDPv4: Connection reset by peer (WSAECONNRESET) (code=10054)
Read it again .. that rule is an example of a working port-forward only.JW0914 wrote:I interpreted your post to mean that forwarding rule was required to make the local directive work, perhaps that's not what you meant?
Traffic wrote:Code:
root@OpenWrt22:~# /etc/init.d/firewall restart
Warning: Unable to locate ipset utility, disabling ipset support
Warning: Section @redirect[0] (OVPN_PFWD_U64022) refers to a destination address on this router, assuming port redirection
which you only realised after I politely asked you ..JW0914 wrote:This thread was never about BB, but CC
Traffic wrote:I am using openwrt x86-generic-ext4 (VM)
You are using ARM ...
I need to confirm: which version of openwrt you use .. AA or BB ?
thanks