R
R
R_E_D2014-08-05 17:39:40
Computer networks
R_E_D, 2014-08-05 17:39:40

Port forwarding to the web server on the connection from Beeline l2tp?

There is a web server 19.168.0.7
local network eth1
Internet on ppp0
forwarding rules

iptables -A FORWARD -i ppp0 -o eth1 -p tcp --dport 80 -d 192.168.0.7 -j ACCEPT 
iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 80 -j DNAT --to-destination 192.168.0.7:80

the iptables rules themselves
#!/bin/sh
PATH=/usr/sbin:/sbin:/bin:/usr/bin
# delete all existing rules.
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
# drop all
iptables -P INPUT DROP
iptables -P FORWARD DROP
# Always accept loopback traffic
iptables -A INPUT -i lo -s 127.0.0.1 -j ACCEPT
# Allow established connections, and those not coming from the outside
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i ppp0 -m state --state NEW -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow LAN traffic
iptables -A INPUT -i eth1 -j ACCEPT
# Allow outgoing connections from the LAN side.
iptables -A FORWARD -i eth1 -o ppp0 -j ACCEPT
# Masquerade.
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
# mtu
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Don't forward from the outside to the inside.
iptables -A FORWARD -i ppp0 -o ppp0 -j REJECT
iptables -A FORWARD -i eth1 -o ppp0 -j REJECT
# Enable routing.
echo 1 > /proc/sys/net/ipv4/ip_forward

if you install a web server on the gate, then everything opens and plows OK.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zorruch, 2014-08-06
@zorruch

What means:
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question