Код:
cat /etc/pf.conf
#интерфейсы
int_if="re0"
ext_if1="vr1"
ext_gw1="192.168.1.1"
ext_if2="vr0"
# Таблицы с направлениями
table <Out1>
table <Out2>
#
nat on $ext_if1 from <Out1> to any -> ($ext_if1)
nat on $ext_if2 from <Out2> to any -> ($ext_if2)
pass in on $int_if route-to ($ext_if1 $ext_gw1) from <Out1> to any keep state
# вротой редирект не нужен так-как совподает с дефаулт роутером
pass out all
проверяем sudo pfctl -t Out1 -T add 192.168.0.2
на внешнем интерфейсе молчек, но если
sudo ipfw disable firewall
тогда
внутренний интерфейс
Код:
tcpdump -npi re0 host 192.168.0.2
17:48:39.628221 IP 192.168.0.2.123 > 195.16.42.125.123: NTPv4, Client, length 48
17:48:39.634062 IP 195.16.42.125.123 > 192.168.0.2.123: NTPv4, Server, length 48
внешний интерфейс
Код:
tcpdump -npi vr1
17:48:39.628262 IP 192.168.1.253.57381 > 195.16.42.125.123: NTPv4, Client, length 48
17:48:39.634043 IP 195.16.42.125.123 > 192.168.1.253.57381: NTPv4, Server, length 48
sudo ipfw table all list
Код:
sudo ipfw table all list
---table(0)---
192.168.0.2/32 0
192.168.0.154/32 0
---table(1)---
192.168.0.2/32 0
192.168.0.154/32 0
---table(2)---
192.168.0.2/32 0
192.168.0.154/32 0
---table(10)---
192.168.0.2/32 1004
192.168.0.154/32 1008
---table(11)---
192.168.0.2/32 1004
192.168.0.154/32 1008
---table(15)---
192.168.0.2/32 0
192.168.0.154/32 0
---table(20)---
192.168.0.2/32 1
192.168.0.154/32 1
---table(21)---
192.168.0.2/32 1
192.168.0.154/32 1
sudo ipfw list
Код:
00050 allow tcp from any to me dst-port 22
00051 allow tcp from me 22 to any
00110 allow ip from any to any via lo0
00120 skipto 1000 ip from me to any
00130 deny icmp from any to any in icmptypes 5,9,13,14,15,16,17
00160 skipto 2000 ip from any to me
00200 skipto 500 ip from any to any via re0
00300 skipto 4500 ip from any to any in
00400 skipto 450 ip from any to any recv re0
00490 allow ip from any to any
00500 skipto 32500 ip from any to any in
00540 allow ip from any to any
01000 allow udp from any 53,7723 to any
01010 allow tcp from any to any setup keep-state
01020 allow udp from any to any keep-state
01100 allow ip from any to any
02000 check-state
02010 allow icmp from any to any
02020 allow tcp from any to any dst-port 80,443
02050 deny ip from any to any via re0
02060 allow udp from any to any dst-port 53,7723
02100 deny ip from any to any
05000 deny ip from not table(0) to any
05001 skipto 5010 ip from table(127) to table(126)
05002 skipto 5030 ip from any to not table(2)
05003 deny ip from any to not table(1)
05004 pipe tablearg ip from table(21) to any
05005 deny ip from any to any
05010 pipe tablearg ip from table(127) to any
05030 deny tcp from table(15) to any dst-port 25
05400 pipe tablearg ip from table(11) to any
32000 deny ip from any to any
32490 deny ip from any to any
33000 pipe tablearg ip from table(126) to table(127)
33001 skipto 33010 ip from not table(2) to any
33002 pipe tablearg ip from any to table(20)
33003 deny ip from any to any
33400 pipe tablearg ip from any to table(10)
65535 deny ip from any to any
почему ipfw режет пакеты?