Доброго времени суток. Помогите разобраться, как по человечески настроить iptables.
Имеется:
Локальная сеть eth0:
172.16.1.0/24
В ней имеется FTP сервер, который должен быть открыт как изнутри, так и снаружи.Внешняя сеть (сеть городского масштаба) eth1:
192.168.104.128
данная сеть имеет в своем составе подсети 192.168.хх.хх (не знаю, какие точно, но их много), а так же имеет подсеть 10.0.хх.хх. В этой сети пров делает привязку по MAC к сетевушке. Если меняется MAC, то карточке назначается адрес вида 10.180.хх.хх, далее необходимо с этим адресом зайти на страничку страничку прова и зарегить новый мак. После чего я и получаю свой статичный ИП 192.168.104.128. В этой же сети поднимается pptp соединение для интернета dsl0 с белым статическим адресом 195.22.нискажу.нискажу.
Никак не могу сделать нормальную таблицу, чтобы у меня внутренняя сеть получала доступ и в инет и в городскую сеть.
ifconfig
dsl0 Link encap:Point-to-Point Protocol
inet addr:195.22.106.143 P-t-P:10.10.10.48 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:697 errors:0 dropped:0 overruns:0 frame:0
TX packets:810 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:45401 (44.3 Kb) TX bytes:53827 (52.5 Kb)
eth0 Link encap:Ethernet HWaddr 00:18:F3:77:7B:88
inet addr:172.16.1.1 Bcast:172.16.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4003 errors:0 dropped:0 overruns:0 frame:0
TX packets:3458 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:380199 (371.2 Kb) TX bytes:1511571 (1.4 Mb)
Interrupt:23
eth1 Link encap:Ethernet HWaddr 00:40:F4:6F:99:69
inet addr:192.168.104.128 Bcast:192.168.104.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:54454 errors:0 dropped:0 overruns:0 frame:0
TX packets:1713 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4332436 (4.1 Mb) TX bytes:138418 (135.1 Kb)
Interrupt:21 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2128 errors:0 dropped:0 overruns:0 frame:0
TX packets:2128 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:276472 (269.9 Kb) TX bytes:276472 (269.9 Kb)
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.10.10.48 * 255.255.255.255 UH 0 0 0 dsl0
192.168.252.5 192.168.104.1 255.255.255.255 UGH 0 0 0 eth1
81.90.0.128 192.168.104.1 255.255.255.128 UG 0 0 0 eth1
172.16.1.0 * 255.255.255.0 U 0 0 0 eth0
192.168.104.0 * 255.255.255.0 U 0 0 0 eth1
195.133.188.0 192.168.104.1 255.255.254.0 UG 0 0 0 eth1
link-local * 255.255.0.0 U 0 0 0 eth0
192.168.0.0 192.168.104.1 255.255.0.0 UG 0 0 0 eth1
10.0.0.0 192.168.104.1 255.0.0.0 UG 0 0 0 eth1
loopback * 255.0.0.0 U 0 0 0 lo
default * 0.0.0.0 U 0 0 0 dsl0
iptables
iptables -F
iptables -t nat -F.
echo 1 > /proc/sys/net/ipv4/ip_forward.
modprobe ip_nat_ftp
## opisyvayu interfeis na storone provaidera
INET_IP="192.168.104.128"
INET_IFACE="eth1"
INET_BROADCAST="192.168.104.255"
## opisyvayu interfeis na storone localnoi seti
LAN_IP="172.16.1.1"
LAN_IP_RANGE="172.16.1.0/24"
LAN_IFACE="eth0"
IPTABLES="/usr/sbin/iptables"
/sbin/depmod -a #podcluchayu modyl
/sbin/modprobe ip_tables #podcluchayu modyl
/sbin/modprobe ip_conntrack #podcluchayu modyl
/sbin/modprobe iptable_filter #podcluchayu modyl
/sbin/modprobe iptable_mangle #podcluchayu modyl
/sbin/modprobe iptable_nat #podcluchayu modyl
/sbin/modprobe ipt_LOG #podcluchayu modyl
/sbin/modprobe ipt_limit #podcluchayu modyl
/sbin/modprobe ipt_state #podcluchayu modyl
/sbin/modprobe ip_nat_ftp #podcluchayu modyl
/sbin/modprobe ip_gre
/sbin/modprobe ip_nat_pptp
/sbin/modprobe ip_conntrack_pptp
#
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source $INET_IP
##
#
iptables -A INPUT -s localhost -j ACCEPT
iptables -A INPUT -p gre -j ACCEPT
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 3128 -j ACCEPT # squid
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 22 -j ACCEPT # ssh
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 25 -j ACCEPT # smtp
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 53 -j ACCEPT # DNS
iptables -A INPUT -p udp -s $LAN_IP_RANGE --dport 53 -j ACCEPT # DNS
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 80 -j ACCEPT # http
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 110 -j ACCEPT # pop3
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 10000 -j ACCEPT # webmin
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 445 -j ACCEPT # samba
iptables -A INPUT -p tcp -s $LAN_IP_RANGE --dport 443 -j ACCEPT # https
#
iptables -A INPUT -p icmp -j ACCEPT #Razreshay pingi iz vne
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT #podderzhivaem vse sozdannye podcly
iptables -P INPUT DROP # zaprechaem vse
Провайдер, естественно, должен думать, что к нему подключена одна машинка, а не сеть :)