
sim4000
Lebende Foren Legende
Moin zusammen,
ich beschäftige mich gerade ein wenig mit iptables und NAT und habe mir dazu einen NAT-Router gebastelt. Es sind bereits einige Portfreigaben eingerichtet, was auch alles super funktioniert.
Aufbau
Iptables Konfiguration
Von einer internen Maschine ins WWW und umgekehrt funktioniert wunderbar. Möchte ich jetzt aber von www.lan.lokal eine Domain aufrufen die auf www.lan.lokal gehostet ist, gibt es ein Connection Refused. Ein Portscan mit nmap zeigt auch, dass von hier auf Port 80 (Portforwarding Port) auf dem Router geschlossen ist.
Hat jemand eine Idee woran das liegen kann?
Viele Grüße
Christian
ich beschäftige mich gerade ein wenig mit iptables und NAT und habe mir dazu einen NAT-Router gebastelt. Es sind bereits einige Portfreigaben eingerichtet, was auch alles super funktioniert.
Aufbau
Code:
öffentlich (eth0) 127.0.0.1 intern (eth1)
91.9.65.78 --- der router --- 192.168.101.1
|--- www.lan.lokal (192.168.101.105)
'--- mail.lan.lokal (192.168.101.101)
Iptables Konfiguration
Code:
# Firewall
*filter
:INPUT DROP [5194:432663]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [3302:462576]
#--> INPUT Chain
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 127.0.0.0/8 -j ACCEPT
-A INPUT -d 127.0.0.0/8 -j ACCEPT
-A INPUT -s 192.168.101.0/24 -j ACCEPT
-A INPUT -d 192.168.101.0/24 -j ACCEPT
#--> Local Network
-A INPUT -i eth1 -j ACCEPT
-A INPUT -p tcp -i eth1 --dport 53 -j ACCEPT
-A INPUT -p udp -i eth1 --dport 53 -j ACCEPT
-A INPUT -p udp -i eth1 --dport 123 -j ACCEPT
COMMIT
# Filter ende
# Network Address Translation
*nat
:PREROUTING ACCEPT [40:2598]
:POSTROUTING ACCEPT [3:160]
:OUTPUT ACCEPT [19:1291]
#--> Webserver
# HTTP
-A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to-destination 192.168.101.105:80
# HTTPS
-A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 192.168.101.105:443
#--> SFTP Apache
-A PREROUTING -i eth0 -p tcp -m tcp --dport 6364 -j DNAT --to-destination 192.168.101.105:22
#--> Mail
# SMTP
-A PREROUTING -i eth0 -p tcp -m tcp --dport 25 -j DNAT --to-destination 192.168.101.101:25
# POP3
-A PREROUTING -i eth0 -p tcp -m tcp --dport 110 -j DNAT --to-destination 192.168.101.101:110
# IMAP
-A PREROUTING -i eth0 -p tcp -m tcp --dport 143 -j DNAT --to-destination 192.168.101.101:143
# SMTPs
-A PREROUTING -i eth0 -p tcp -m tcp --dport 465 -j DNAT --to-destination 192.168.101.101:465
# IMAPs
-A PREROUTING -i eth0 -p tcp -m tcp --dport 993 -j DNAT --to-destination 192.168.101.101:993
# POP3s
-A PREROUTING -i eth0 -p tcp -m tcp --dport 995 -j DNAT --to-destination 192.168.101.101:995
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# NAT ende
Von einer internen Maschine ins WWW und umgekehrt funktioniert wunderbar. Möchte ich jetzt aber von www.lan.lokal eine Domain aufrufen die auf www.lan.lokal gehostet ist, gibt es ein Connection Refused. Ein Portscan mit nmap zeigt auch, dass von hier auf Port 80 (Portforwarding Port) auf dem Router geschlossen ist.
Hat jemand eine Idee woran das liegen kann?
Viele Grüße
Christian