Log in

Bekijk de volledige versie : iptables problem



zumike
16-05-2008, 22:03
can you help me?
no access wan to webserver
i have usb modem
lighttpd running on 80 port and ssh server too
lan to server and lan to ssh ok

post-firewall
#!/bin/sh
iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 81 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i -p tcp --dport 22 -j DNAT --to-destination :22
#ssh kivűlről
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 22 -j DNAT --to-destination $
#elvilegvebszerver
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $
#torrent
iptables -A INPUT -p tcp --dport 2106:2706 -j ACCEPT
iptables -A INPUT -j DROP


iptables -L

Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere state RELATED,ESTABL ISHED
ACCEPT all -- anywhere anywhere state NEW
ACCEPT all -- anywhere anywhere state NEW
ACCEPT igmp -- anywhere BASE-ADDRESS.MCAST.NET/4
ACCEPT udp -- anywhere BASE-ADDRESS.MCAST.NET/4udp dpt:!upnp
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:81
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpts:2106:2706
DROP all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP all -- anywhere anywhere state INVALID
ACCEPT udp -- anywhere BASE-ADDRESS.MCAST.NET/4
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST,AC K/SYN TCPMSS clamp to PMTU
ACCEPT all -- anywhere anywhere state RELATED,ESTABL ISHED
DROP all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate DNAT

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain MACS (0 references)
target prot opt source destination

Chain SECURITY (0 references)
target prot opt source destination
RETURN tcp -- anywhere anywhere tcp flags:SYN,RST,AC K/SYN limit: avg 1/sec burst 5
RETURN tcp -- anywhere anywhere tcp flags:FIN,SYN,RS T,ACK/RST limit: avg 1/sec burst 5
RETURN udp -- anywhere anywhere limit: avg 5/sec bur st 5
RETURN icmp -- anywhere anywhere limit: avg 5/sec bur st 5
DROP 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 (0 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

al37919
17-05-2008, 05:57
this piece is useless:

iptables -t nat -A PREROUTING -i -p tcp --dport 22 -j DNAT --to-destination :22
#ssh kivűlről
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 22 -j DNAT --to-destination $
#elvilegvebszerver
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 80 -j DNAT --to-destination $

the rest seems to be ok. The content of INPUT chain is also ok.

Does 22 and 81 working? If so, may be provider blocks port 80?