Portál AbcLinuxu, 8. listopadu 2025 14:36
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
ale routr mi pakety pořád zahazuje proto zde dám výpis iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:webcache
MACS all -- anywhere anywhere
logdrop all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere state NEW
ACCEPT all -- anywhere anywhere state NEW
SECURITY all -- anywhere anywhere state NEW
logdrop all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
MACS all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
logdrop all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
logdrop all -- anywhere anywhere
SECURITY all -- anywhere anywhere state NEW
logdrop all -- anywhere anywhere ctstate DNAT
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain MACS (2 references)
target prot opt source destination
Chain SECURITY (2 references)
target prot opt source destination
RETURN tcp -- anywhere anywhere tcp flags:SYN,RST,ACK/SYN limit: avg 1/sec burst 5
RETURN tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/RST limit: avg 1/sec burst 5
RETURN udp -- anywhere anywhere limit: avg 5/sec burst 5
RETURN icmp -- anywhere anywhere limit: avg 5/sec burst 5
logdrop all -- anywhere anywhere
Chain logaccept (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level warning tcp-sequence tcp-options ip-options prefix `ACCEPT '
ACCEPT all -- anywhere anywhere
Chain logdrop (6 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level warning tcp-sequence tcp-options ip-options prefix `DROP '
DROP all -- anywhere anywhere
a výpis z logu zahozeného paketu
Jun 10 14:20:43 kernel: DROP IN=eth1 OUT=br0 SRC=193.200.150.137 DST=192.168.168.70 LEN=60 TOS=0x00 PREC=0x00 TTL=53 ID=26131 DF PROTO=TCP SPT=41483 DPT=8080 SEQ=562143518 ACK=0 WINDOW=5840 RES=0x00 SYN URGP=0 OPT (020405B40402080A299FEA370000000001030a jeste mám Port Forwarding port 8080 na IP 192.168.168.70 port 80 Děkuji.
Řešení dotazu:
Zadané pravidlo máš v pořádku, povoluje přístup na router, pokud ovšem chceš přesměrovat port na určité pc tak můžeš např. použít: iptables -A PREROUTING -t nat -p tcp -i ppp0 --dport 8080 -j DNAT --to 192.168.2.2:8080
[wl500g@WL-500g root]$ iptables -t nat -n -L Chain PREROUTING (policy ACCEPT) target prot opt source destination VSERVER all -- 0.0.0.0/0 11.22.33.44 Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- !11.22.33.44 0.0.0.0/0 MASQUERADE all -- 192.168.168.0/24 192.168.168.0/24 Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain VSERVER (1 references) target prot opt source destination DNAT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 to:192.168.168.70:8080
FORWARD. PREROUTING a POSTROUTING se používá většinou pro NAT.
pkts bytes target prot opt in out source destination
0 0 DNAT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 to:192.168.168.70:8080
FORWARD. Ten musíte řešit, když řešíte komunikaci z WAN do LAN.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.