root@home-server:/home/remalex# iptables-save
# Generated by iptables-save v1.4.12 on Fri May 11 19:47:05 2012
*nat
:PREROUTING ACCEPT [368351:35733617]
:INPUT ACCEPT [322810:31843448]
:OUTPUT ACCEPT [99631:6695149]
:POSTROUTING ACCEPT [99538:6689614]
-A POSTROUTING -s 10.0.5.0/24 ! -d 10.0.5.0/24 -j MASQUERADE
COMMIT
# Completed on Fri May 11 19:47:05 2012
# Generated by iptables-save v1.4.12 on Fri May 11 19:47:05 2012
*mangle
:PREROUTING ACCEPT [29856784:32646306139]
:INPUT ACCEPT [28207879:31703207155]
:FORWARD ACCEPT [1638795:942537605]
:OUTPUT ACCEPT [19139997:2690134529]
:POSTROUTING ACCEPT [20779867:3632878683]
-A FORWARD -o ppp0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:65495 -j TCPMSS --clamp-mss-to-pmtu
COMMIT
# Completed on Fri May 11 19:47:05 2012
root@home-server:/home/remalex# sudo iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 369K packets, 36M bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 323K packets, 32M bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 99662 packets, 6697K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 99566 packets, 6691K bytes)
pkts bytes target prot opt in out source destination
45617 3892K MASQUERADE all -- * * 10.0.5.0/24 !10.0.5.0/24
root@home-server:/home/remalex# cat /etc/network/interfaces
auto lo eth0 eth1 eth2 eth0:20 dsl-provider
iface lo inet loopback
iface eth0 inet static
address 10.0.5.1
netmask 255.255.255.0
post-up iptables-restore < /etc/iptables.up.rules
iface eth1 inet dhcp
iface dsl-provider inet ppp
pre-up /sbin/ifconfig eth2 up # line maintained by pppoeconf
provider dsl-provider
iface eth2 inet static #ПОКА НЕ ИСПОЛЬЗУЮ, ПРОСТО НАСТРОИЛ
address 10.19.0.2
netmask 255.255.255.0
broadcast 10.19.0.255
network 10.19.0.0
iface eth0:20 inet static #ПОКА НЕ ИСПОЛЬЗУЮ, ПРОСТО НАСТРОИЛ
address 192.168.28.1
netmask 255.255.255.0
broadcast 192.168.28.255
network 192.168.28.0
root@home-server:/home/remalex# ifconfig -a
eth0 Link encap:Ethernet HWaddr 14:da:e9:f5:c8:e1
inet addr:10.0.5.1 Bcast:10.0.5.255 Mask:255.255.255.0
inet6 addr: fe80::16da:e9ff:fef5:c8e1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:894746 errors:0 dropped:5082 overruns:0 frame:0
TX packets:1049615 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:136045278 (136.0 MB) TX bytes:918241447 (918.2 MB)
Interrupt:18 Память:fbe00000-fbe20000
eth0:20 Link encap:Ethernet HWaddr 14:da:e9:f5:c8:e1
inet addr:192.168.28.1 Bcast:192.168.28.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18 Память:fbe00000-fbe20000
eth1 Link encap:Ethernet HWaddr b0:48:7a:80:c8:d0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:66 Base address:0x6000
eth2 Link encap:Ethernet HWaddr f4:ec:38:80:5a:91
inet addr:10.19.0.2 Bcast:10.19.0.255 Mask:255.255.255.0
inet6 addr: fe80::f6ec:38ff:fe80:5a91/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29726233 errors:0 dropped:0 overruns:0 frame:0
TX packets:19433867 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33182722939 (33.1 GB) TX bytes:3110231356 (3.1 GB)
Interrupt:18 Base address:0x8000
lo Link encap:Локальная петля (Loopback)
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:30390 errors:0 dropped:0 overruns:0 frame:0
TX packets:30390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:28049178 (28.0 MB) TX bytes:28049178 (28.0 MB)
ppp0 Link encap:Протокол PPP (Point-to-Point Protocol)
inet addr:46.159.88.92 P-t-P:85.175.1.67 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:29723630 errors:0 dropped:0 overruns:0 frame:0
TX packets:19751529 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:32524885995 (32.5 GB) TX bytes:2712654875 (2.7 GB)
root@home-server:/home/remalex# route -n
Таблица маршутизации ядра протокола IP
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
10.0.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.19.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
85.175.1.67 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.28.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
root@home-server:/home/remalex# cat /proc/sys/net/ipv4/ip_forward
1
root@home-server:/home/remalex# arp -n -i eth1
arp: в 9 записях совпадения не найдено.
root@home-server:/home/remalex# arp -n -i eth0
Адрес HW-тип HW-адрес Флаги Маска Интерфейс
10.0.5.20 ether 00:27:22:56:39:9d C eth0
10.0.5.60 ether 00:09:34:28:14:e2 C eth0
10.0.5.11 ether 00:1a:92:da:ce:12 C eth0
10.0.5.80 ether 7c:2f:80:1e:9b:a9 C eth0
10.0.5.100 ether 00:18:f3:5e:07:67 C eth0
10.0.5.45 ether 34:7e:39:6b:fa:42 C eth0
10.0.5.203 ether 00:0f:ea:61:99:5f C eth0
10.0.5.214 ether 00:1f:d0:92:9f:ea C eth0
10.0.5.50 ether 00:27:22:60:8f:10 C eth0
Пользователь решил продолжить мысль 11 Мая 2012, 20:16:33:
все эти выводы я сделал после того как руками прописал
sudo iptables -t nat -A POSTROUTING -s 10.0.5.0/24 ! -d 10.0.5.0/24 -j MASQUERADE
а вот что показывает сразу после перезагрузки:
remalex@home-server:~$ sudo iptables-save
[sudo] password for remalex:
# Generated by iptables-save v1.4.12 on Fri May 11 20:13:54 2012
*mangle
:PREROUTING ACCEPT [5507:5015750]
:INPUT ACCEPT [4006:4889969]
:FORWARD ACCEPT [1501:125781]
:OUTPUT ACCEPT [3668:5136965]
:POSTROUTING ACCEPT [5247:5270436]
-A FORWARD -o ppp0 -p tcp -m tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:65495 -j TCPMSS --clamp-mss-to-pmtu
COMMIT
# Completed on Fri May 11 20:13:54 2012