Есть скрипт для nat:
#!/bin/sh
#########
# VARIBLES #
########
WAN_ADDR=192.0.4.146
WAN_DEV=eth0
LAN_DEV=eth1
LAN_GATE=192.168.0.3
LAN_SUBNET=192.168.0.0/16
###########
# RESET RULES #
##########
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# reset the default policies in the nat table.
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
# reset the default policies in the mangle table.
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
# flush all the rules in the filter and nat tables.
iptables -F
iptables -t nat -F
iptables -t mangle -F
# erase all chains that's not default in filter and nat table.
iptables -X
iptables -t nat -X
iptables -t mangle -X
###########
# LOCAL RULES #
###########
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m tcp -s 195.239.230.35 -p tcp --dport 22 -j ACCEPT
###########
# NAT OUTPUT #
###########
iptables -t nat -A POSTROUTING -o ${WAN_DEV} -j SNAT --to-source ${WAN_ADDR}
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p icmp -s ${LAN_SUBNET} -j ACCEPT
iptables -A FORWARD -p tcp -m tcp --dport 53 -s ${LAN_SUBNET} -j ACCEPT
iptables -A FORWARD -p udp -m udp --dport 53 -s ${LAN_SUBNET} -j ACCEPT
iptables -A FORWARD -p tcp -m tcp --dport 80 -s ${LAN_SUBNET} -j ACCEPT
##########
# SERVER PUB #
##########
#www in
#iptables -t nat -A PREROUTING -d ${WAN_ADDR} -p tcp --dport 80 -j DNAT --to-destination 10.10.10.11
#iptables -A FORWARD -p tcp -m tcp --dport 80 -d 192.168.0.4 -j ACCEPT
#ftp in
#iptables -t nat -A PREROUTING -d ${WAN_ADDR} -p tcp --dport 21 -j DNAT --to-destination 10.10.10.11
#iptables -A FORWARD -p tcp -m tcp --dport 21 -d 192.168.0.4 -j ACCEPT
#PosrgreSQL
iptables -t nat -A PREROUTING -d ${WAN_ADDR} -p tcp --dport 5432 -j DNAT --to-destination 10.10.10.11
iptables -A FORWARD -p tcp -m tcp --dport 5432 -d 192.168.0.4 -j ACCEPT
##########
# FOR OTHER #
##########
iptables -A INPUT -j DROP
iptables -A FORWARD -j DROP
######
# SAVE #
######
iptables-save > /etc/iptables.rules
WAN_ADDR – ip адрес, который смотрит в интернет
WAN_DEV – имя устройства, которое смотрит в интернет
LAN_DEV – имя устройства, которое смотрит в локальную сеть
LAN_GATE – ip адрес, который смотрит в локалку
LAN_SUBNET – локальная подсеть
При таких настройках я могу соединиться с локалкой провайдера. Но внешний интернет не работает все равно.
Как сделать, чтобы работало ppp0 соединение? На ppp0 статический адрес.