Раз пошла такая пьянка ...
I) Fisher74, замечания по делу. Принимается, в дальнейшем учтем.
Видимо нужно рассматривать два основных вопроса: КАК включить iptables и ЧТО, то есть начинка сетевого экрана, которая определяетсяется через написание правил.
II) «Путешествуя» по Интернету, часто встречал конструкции:
post-up iptables-restore </etc/iptables.conf
post-up /etc/nat
up iptables-restore < /etc/ltsp/nat
iptables-save > /etc/iptables/rules-save
Приведу то, что успел зафиксировать.
II.1)
https://forum.ubuntu.ru/index.php?topic=107492.0/etc/network/interfaces
Код: Bash
1. auto lo
2. iface lo inet loopback
3. post-up iptables-restore </etc/iptables.conf
4. auto eth0
5. iface eth0 inet dhcp
6. auto eth1
7. iface eth1 inet static
8. address 192.168.0.1
9. netmask 255.255.255.0
Сохраняем, закрываем, перезапускаем сетевой интерфейс, смотрящий в локальную сеть КЛИЕНТА.
II.2)
http://interface31.ru/tech_it/2009/11/linux-nastrojka-routera-nat-dhcp-squid.htmlСохраняем (F2), для автоматического запуска скрипта снова открываем/etc/network/interfaces и в самый конец файла дописываем:
post-up /etc/nat
II.3)https://help.ubuntu.com/community/UbuntuLTSP/ThinClientHowtoNAT
Enable network address translation. By default the ltsp network address/mask is 192.168.0.0/24. Remember to change the example to fit your network setup. Use a command like:
sudo iptables --table nat --append POSTROUTING --jump MASQUERADE --source 192.168.0.0/24
to enable NAT. To make this setting permanent run
sudo sh -c 'iptables-save > /etc/ltsp/nat'
and add the extra line up iptables-restore < /etc/ltsp/nat to the bottom of the eth0 (or whichever is your LTSP interface) stanza of /etc/network/interfaces so it looks something like
auto eth0
iface eth0 inet static
address 192.168.0.254
netmask 255.255.255.0
broadcast 192.168.0.255
network 192.168.0.0
up iptables-restore < /etc/ltsp/nat
. This creates a script called /etc/ltsp/nat which restores the NAT next time the eth0 network interface comes up. Test: ping the dns server on the main network from the test PC.
II.4)
http://www.bubuntu.spb.ru/gateway-ubuntu-server/11 iface eth0 inet static
12address 10.28.129.186
13 network 0.0.0.0
14 netmask 255.255.255.0
15 broadcast 255.255.255.255
16 gateway 10.208.128.1
17 hwaddress ether 00:11:6B:3F:10:39
18 post-up iptables-restore > /etc/iptables.up.rules
II.5)
http://ubuntologia.ru/firewall-via-iptablesи так далее по образу и подобию. А теперь создаем файл /etc/init.d/rc.iptables и редактируем его.
….............
$0 stop
$0 start
;;
save)
iptables-save > /etc/iptables/rules-save
;;
load)
….............
В свете этих примеров непопятно мне утверждение от
AnrDaemon: «Ничего не нужно делать. Потому что всё неправильно.
Сначала исправьте вашу 18-ю линию, уберите редирект к чёртовой матери.»
III) Да по ссылке
http://posix.ru/network/iptables/ iptables включается как управляющий скрипт расположеный в каталоге /etc/init.d/.
Не скрываю, мне нравится эта ссылка тем, что предоставляет достаточное количество образцов-правил для iptables.