1106 shaares
3 results
tagged
iptables
#!/bin/bash
# usage : port_forward ip_destination port_destination wan_interface
sudo iptables -t nat -A PREROUTING -p tcp -i $3 --dport $2 -j DNAT --to-destination $1:$2
sudo iptables -A FORWARD -p tcp -d $1 --dport $2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
Oui, simple oubli de ma part, shaarli doit mieux marcher maintenant...
# usage : port_forward ip_destination port_destination wan_interface
sudo iptables -t nat -A PREROUTING -p tcp -i $3 --dport $2 -j DNAT --to-destination $1:$2
sudo iptables -A FORWARD -p tcp -d $1 --dport $2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
Oui, simple oubli de ma part, shaarli doit mieux marcher maintenant...
eth0 = WAN
eth1 = LAN
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
eth1 = LAN
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT