Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien

Vreemd port forwarding probleem met openWRT (Xiaomi router)

Pagina: 1
Acties:

  • gijs.vdh
  • Registratie: Augustus 2010
  • Laatst online: 28-11 22:15
Ik ben bezig om de Xiaomi Mi router te configureren om mijn huidige te vervangen. Een aantal functies, zoals port forwarding, worden niet via de webinterface ondersteund. Nu is het wel mogelijk om SSH access tot het onderliggende openWRT systeem te krijgen. Via /etc/config/firewall kunnen geforwarde porten ingesteld worden. Daar stoot ik echt op een probleem: ik krijg port forwarding niet geheel werkend.

Ik kan een poort forwarden naar een pc in het interne netwerk, maar dit resulteert er echer in dat slechts het eerste packet goed aankomt. Een port-scan zegt dat de poort open staat, een telnet verbinding hangt na connectie: allemaal te verwachten. Een website kan ik echter niet bereiken. Na wat getest met het doorsturen van UDP packets met het programma nc, blijkt nu dus dat enkel het eerst verzonden packet aankomt. Zowel het eerste vanaf de server verzonden als het eerste vanaf de client trouwens.

Kan een netwerkspecialist mij in de goede richting sturen? Indien gewenst kan ik de volledige inhoud van /etc/config/firewall of /etc/sysctl.conf tonen.

  • vanaalten
  • Registratie: September 2002
  • Nu online
Met heel weinig verstand van zaken:
werkt die firewall met iptables? Is het dan niet een kwestie van het verkeer van bestaande verbindingen accepteren?

Als ik op mijn Linux machine kijk (geen router, gewoon een server in m'n LAN) dan heb ik bijvoorbeeld:
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
... er in staan: bestaand verkeer accepteren. En daarnaast nog allerlei regels voor nieuw verkeer.

Maar goed - het is denk ik wel handig om die twee configfiles te posten.

  • gijs.vdh
  • Registratie: Augustus 2010
  • Laatst online: 28-11 22:15
Van iptables ken ik helaas niets. Het enige wat ik weet is dat de firewall regels omgezet worden in regels voor iptables. Ik post hieronder de verschillende bestanden, alsook de inhoud van de iptables. Zoals te zien tracht ik op dit moment enkel poort 7000 te forwarden.

De regel die jij aanhaalt zit er niet in. Ik zal er eens wat over opzoeken en dan een gelijkaardige regel trachten toe te voegen.

/etc/config/firewall:
config defaults
	option syn_flood '0'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'

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

config zone
	option name 'wan'
	option network 'wan'
	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-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option src_ip 'fe80::/10'
	option src_port '547'
	option dest_ip 'fe80::/10'
	option dest_port '546'
	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 include 'wanmonitor'
	option path '/usr/sbin/wan.monitor start'
	option reload '1'
	option enabled '1'

config include 'webinitrdr'
	option path '/lib/firewall.sysapi.loader webinitrdr'
	option reload '1'
	option enabled '1'

config include 'dnsmiwifi'
	option path '/lib/firewall.sysapi.loader dnsmiwifi'
	option reload '1'
	option enabled '1'

config include 'ttlset'
	option path '/lib/firewall.sysapi.loader ttlset'
	option reload '1'
	option enabled '1'

config include 'portalfilter'
	option path '/lib/firewall.sysapi.loader portalfilter'
	option reload '1'
	option enabled '1'

config include 'macfilter'
	option path '/lib/firewall.sysapi.loader macfilter'
	option reload '1'
	option enabled '1'

config include 'miqos'
	option path '/lib/firewall.sysapi.loader miqos'
	option reload '1'

config include 'firewalluser'
	option path '/etc/firewall.user'
	option reload '1'

config rule 'xunleiwantcpports'
	option src 'wan'
	option dest_port '1080 4662 2080 2062'
	option proto 'tcp'
	option target 'ACCEPT'
	option name ''\''xunlei wan accept tcp port 1080 4662 2080 2062'\'''

config rule 'xunleiwanudpports'
	option name 'xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066'
	option src 'wan'
	option dest_port '4661 3027 888 666 2037 2061 2048 2066'
	option proto 'udp'
	option target 'ACCEPT'

config include 'miniupnpd'
	option type 'script'
	option path '/usr/share/miniupnpd/firewall.include'
	option family 'IPv4'
	option reload '1'

config redirect 'web2'
	option name 'web2'
	option src 'wan'
	option proto 'tcpudp'
	option src_dport '7000'
	option dest_ip '192.168.31.230'
	option dest_port '7000'
	option dest 'lan'
	option target 'DNAT'


sysctl.conf:
kernel.panic=3
fs.file-max = 1000000
net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.all.arp_ignore=1
net.ipv4.ip_forward=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.tcp_ecn=0
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_keepalive_time=60
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_sack=1
net.ipv4.tcp_dsack=1
net.ipv4.tcp_mtu_probing=1

net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1

net.netfilter.nf_conntrack_acct=1
net.netfilter.nf_conntrack_checksum=0
net.netfilter.nf_conntrack_max=81920
net.netfilter.nf_conntrack_tcp_timeout_established=600
net.netfilter.nf_conntrack_udp_timeout=120
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=30
net.netfilter.nf_conntrack_udp_timeout_stream=180

net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_sent=60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_sent2=60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_recv=30
net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait=10
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait=30
net.ipv4.netfilter.ip_conntrack_tcp_timeout_last_ack=10
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait=10
net.ipv4.netfilter.ip_conntrack_tcp_timeout_max_retrans=30

net.ipv4.tcp_max_tw_buckets=40960
#net.ipv4.netfilter.ip_conntrack_buckets=8192
net.ipv4.ip_local_port_range=1025 65530

net.ipv4.tcp_tw_reuse=1

# disable bridge firewalling by default
net.bridge.bridge-nf-call-arptables=0
net.bridge.bridge-nf-call-ip6tables=0
net.bridge.bridge-nf-call-iptables=0

vm.dirty_background_ratio=5
vm.dirty_ratio=10
vm.dirty_expire_centisecs=500
vm.dirty_writeback_centisecs=200
vm.swappiness=80
vm.vfs_cache_pressure=120
vm.min_free_kbytes=32768


iptables -L -v -n:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
86728 7079K delegate_input  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
23325 1756K delegate_forward  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
42402  160M delegate_output  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain MINIUPNPD (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            192.168.31.130       udp dpt:64275
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            192.168.31.130       udp dpt:64102

Chain delegate_forward (1 references)
 pkts bytes target     prot opt in     out     source               destination         
23325 1756K forwarding_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for forwarding */
12109 1136K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
  916 49543 zone_lan_forward  all  --  br-lan *       0.0.0.0/0            0.0.0.0/0           
    0     0 zone_wan_forward  all  --  pppoe-wan *       0.0.0.0/0            0.0.0.0/0           
    0     0 reject     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain delegate_input (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 8389  968K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
78339 6111K input_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for input */
69929 5401K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
 4224  402K zone_lan_input  all  --  br-lan *       0.0.0.0/0            0.0.0.0/0           
 4186  308K zone_wan_input  all  --  pppoe-wan *       0.0.0.0/0            0.0.0.0/0           

Chain delegate_output (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 8389  968K ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
34013  159M output_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for output */
20453  158M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
 3788  978K zone_lan_output  all  --  *      br-lan  0.0.0.0/0            0.0.0.0/0           
 9772  569K zone_wan_output  all  --  *      pppoe-wan  0.0.0.0/0            0.0.0.0/0           

Chain forwarding_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain forwarding_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         
23325 1756K macfilter_wan  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain forwarding_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain input_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain input_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         
  598 70021 macfilter_admin  tcp  --  br-lan *       0.0.0.0/0            192.168.31.1         multiport dports 80,443,23,22

Chain input_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain macfilter_admin (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain macfilter_lan (0 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain macfilter_wan (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 9060  472K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            MAC 70:18:8B:82:16:15
  187 10969 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            MAC F6:D0:10:12:E6:44
 1053 87893 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            MAC 00:1D:09:BD:E5:C2

Chain output_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain output_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain output_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination         

Chain reject (3 references)
 pkts bytes target     prot opt in     out     source               destination         
 1053 44124 REJECT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with tcp-reset
 3132  263K REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable

Chain zone_lan_dest_ACCEPT (3 references)
 pkts bytes target     prot opt in     out     source               destination         
 3788  978K ACCEPT     all  --  *      br-lan  0.0.0.0/0            0.0.0.0/0           

Chain zone_lan_forward (1 references)
 pkts bytes target     prot opt in     out     source               destination         
  916 49543 forwarding_lan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for forwarding */
    0     0 zone_lan_dest_ACCEPT  tcp  --  *      *       192.168.31.0/24      192.168.31.230       tcp dpt:7000 /* web2 (reflection) */
    0     0 zone_lan_dest_ACCEPT  udp  --  *      *       192.168.31.0/24      192.168.31.230       udp dpt:7000 /* web2 (reflection) */
  916 49543 zone_wan_dest_ACCEPT  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* forwarding lan -> wan */
    0     0 zone_lan_src_REJECT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain zone_lan_input (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 4224  402K input_lan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for input */
 4224  402K zone_lan_src_ACCEPT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain zone_lan_output (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 3788  978K output_lan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for output */
 3788  978K zone_lan_dest_ACCEPT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain zone_lan_src_ACCEPT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 4224  402K ACCEPT     all  --  br-lan *       0.0.0.0/0            0.0.0.0/0           

Chain zone_lan_src_REJECT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 reject     all  --  br-lan *       0.0.0.0/0            0.0.0.0/0           

Chain zone_wan_dest_ACCEPT (2 references)
 pkts bytes target     prot opt in     out     source               destination         
10688  618K ACCEPT     all  --  *      pppoe-wan  0.0.0.0/0            0.0.0.0/0           

Chain zone_wan_forward (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MINIUPNPD  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 forwarding_wan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for forwarding */
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.168.31.230       tcp dpt:7000 /* web2 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            192.168.31.230       udp dpt:7000 /* web2 */
    0     0 zone_wan_src_REJECT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain zone_wan_input (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 4186  308K input_wan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for input */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:68 /* Allow-DHCP-Renew */
    1    28 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0            icmptype 8 /* Allow-Ping */
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:1080 /* 'xunlei wan accept tcp port 1080 4662 2080 2062' */
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:4662 /* 'xunlei wan accept tcp port 1080 4662 2080 2062' */
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:2080 /* 'xunlei wan accept tcp port 1080 4662 2080 2062' */
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:2062 /* 'xunlei wan accept tcp port 1080 4662 2080 2062' */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:4661 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:3027 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:888 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:666 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:2037 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:2061 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:2048 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0            udp dpt:2066 /* xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066 */
 4185  308K zone_wan_src_REJECT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain zone_wan_output (1 references)
 pkts bytes target     prot opt in     out     source               destination         
 9772  569K output_wan_rule  all  --  *      *       0.0.0.0/0            0.0.0.0/0            /* user chain for output */
 9772  569K zone_wan_dest_ACCEPT  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain zone_wan_src_REJECT (2 references)
 pkts bytes target     prot opt in     out     source               destination         
 4185  308K reject     all  --  pppoe-wan *       0.0.0.0/0            0.0.0.0/0           

  • gijs.vdh
  • Registratie: Augustus 2010
  • Laatst online: 28-11 22:15
De router software ontving enkele uren geleden een update, die port forwarding via de web-interface mogelijk maakt.

Toch slaag ik er nog altijd niet in om het succesvol te laten werken: het effect is hetzelfde als voorheen. Heeft niemand een idee wat aan de basis van deze fout kan liggen?

Update: Ik heb ondertussen erg veel getest en informatie opgezocht. Ik kan niemand met hetzelfde probleem terugvinden. Op het support forum van de Xiaomi router zijn ook geen meldingen van een port forwarding probleem te vinden. Nu dacht ik dat het probleem mogelijk bij mijn adsl modem ligt. De Xiaomi maakt via PPPOE een connectie met mijn provider, dus ik dacht dat de eerste router dan enkel als modem gebruikt werd? Daar ik geen info over het probleem kan terugvinden, ligt het misschien toch bij de combinatie van beide routers?

[ Voor 48% gewijzigd door gijs.vdh op 07-06-2014 14:16 ]


  • Kiswum
  • Registratie: November 2004
  • Laatst online: 19-10 20:44

Kiswum

Gadget reviewer

Ik heb een Mi Wi-Fi in mijn bezit. Zijn er zaken die ik voor je kan testen?

De router zit achter de Xperiabox, maar portforwarding heb ik op deze Xperiabox aan staan. Het is denk ik beter om dat op de 1e router in te stellen ipv de router die daar achter zit.

Link naar mijn website voor alle reviews en blogs: Kiswum.com.


  • ihre
  • Registratie: Juni 2004
  • Laatst online: 12-02 09:36
code:
1
2
3
4
5
6
7
8
9
config redirect 'web2'
    option name 'web2'
    option src 'wan'
    option proto 'tcpudp'
    option src_dport '7000'
    option dest_ip '192.168.31.230'
    option dest_port '7000'
    option dest 'lan'
    option target 'DNAT'


Moet worden:

code:
1
2
3
4
5
6
7
8
config redirect
    option name 'web2'
    option src 'wan'
    option proto 'tcpudp'
    option src_dport '7000'
    option dest_ip '192.168.31.230'
    option dest 'lan'
    option target 'DNAT'


option dest_port '7000'

Die is overbodig, aangezien je geen gebruik hoeft te maken van port redirection.

Daarnaast heeft iedere OpenWrt router waar LuCi (de WebUI) op draait, luci-app-firewall. Firewall regels zijn aan te passen via Network -> Firewall -> Port Forwards.

Verder is het verhaal ook vreemd, de OpenWrt router zet een PPPoE verbinding op zeg je, maar die hangt achter je ADSL modem? ADSL werkt met PPPoA.

Je zou evt de firewall & dhcp server op je ADSL modem uit kunnen zetten en door de Xiaomi af laten handelen. Zorg dan dat je het LAN IP van je ADSL modem gebruikt als gateway op de Xiaomi.

ps. of je hebt 2 providers, en het totaal verkeerd aangesloten?

[ Voor 41% gewijzigd door ihre op 11-07-2014 19:06 ]

Pagina: 1