Опять же старые грабли.
задача мир - в дыру 1 уа-х в дыру 2
проблема - каким принцыпом связка ипфв +пф даже не пойму.
в старом биллинге все просто было. форвард и нат на ип 1 и форвард и нат на ип 2
тут же для меня темный лес.
пф
pf.conf
set limit states 128000
set optimization aggressive
nat pass on em1 from 10.0.0.0/8 to any -> em1
ипфв
gw# ipfw show
00040 24606 1506346 allow tcp from any to me dst-port 22
00041 46591 7439172 allow tcp from me 22 to any
00080 1039954 488543301 count ip from any to table(126) out
00081 1534424 1700296550 count ip from table(126) to any out
00086 2485017 2922564774 count ip from any to table(10) out
00087 1732616 553997068 count ip from table(10) to any out
00100 4 192 deny tcp from any to any dst-port 445
00110 159244 33956664 allow ip from any to any via lo0
00111 13613 1089099 pipe 1 ip from table(2) to table(46) in
00112 3937 221604 pipe 2 ip from table(46) to table(2) out
00113 9703 776299 allow ip from table(2) to table(46)
00120 13819 6480214 skipto 1000 ip from me to any
00130 0 0 deny icmp from any to any in icmptypes 5,9,13,14,15,16,17
00140 2532 2159669 deny ip from any to table(120)
00150 2186 227608 deny ip from table(120) to any
00160 15100 4005905 skipto 2000 ip from any to me
00200 4164284 3487960580 skipto 500 ip from any to any via em1
00300 1740472 556025957 skipto 4500 ip from any to any in
00400 2479041 2921771338 skipto 450 ip from any to any recv em1
00420 49161 2615798 tee 1 ip from any to any
00450 2528206 2924387096 tee 2 ip from any to any
00490 2528203 2924387136 allow ip from any to any
00500 2490561 2937361483 skipto 32500 ip from any to any in
00510 1673751 550604971 tee 1 ip from any to any
00540 1673751 550604971 allow ip from any to any
01000 1922 498388 allow udp from any 53,7723 to any
01010 69 6676 allow tcp from any to any setup keep-state
01020 9111 1074478 allow udp from any to any keep-state
01100 7251 5657639 allow ip from any to any
02000 0 0 check-state
02010 2377 2438362 allow icmp from any to any
02020 6065 678136 allow tcp from any to any dst-port 80,443
02025 0 0 allow tcp from any to any dst-port 80,5006
02050 157 12824 deny ip from any to any via em1
02060 2017 129493 allow udp from any to any dst-port 53,7723
02100 3 144 deny ip from any to any
05000 15066 2160735 deny ip from not table(0) to any
05001 0 0 skipto 5010 ip from table(127) to table(126)
05002 1725406 553865222 skipto 5030 ip from any to not table(2)
05003 0 0 deny ip from any to not table(1)
05004 0 0 pipe tablearg ip from table(21) to any
05005 0 0 deny ip from any to any
05010 0 0 pipe tablearg ip from table(127) to any
05030 0 0 deny tcp from table(15) to any dst-port 25
05146 0 0 allow ip from table(47) to table(46)
05226 0 0 allow ip from table(127) to table(126)
05400 1725406 553865222 pipe tablearg ip from table(11) to any
32000 0 0 deny ip from any to any
32490 0 0 deny ip from any to any
33000 0 0 pipe tablearg ip from table(126) to table(127)
33001 2490561 2937361483 skipto 33010 ip from not table(2) to any
33002 0 0 pipe tablearg ip from any to table(20)
33003 0 0 deny ip from any to any
33146 0 0 allow ip from table(46) to table(47)
33226 0 0 allow ip from table(126) to table(127)
33400 2490411 2937347855 pipe tablearg ip from any to table(10)
65535 150 13628 allow ip from any to any
gw# ifconfig
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
ether 00:30:48:2d:a9:cc
inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255
inet 172.16.0.51 netmask 0xffffff00 broadcast 172.16.0.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
ether 00:30:48:2d:a9:cd
inet 172.31.0.2 netmask 0xffffff00 broadcast 172.31.0.255
inet 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
pflog0: flags=0<> metric 0 mtu 33204
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
pfsync0: flags=0<> metric 0 mtu 1460
syncpeer: 224.0.0.240 maxupd: 128
ng0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> metric 0 mtu 1480
inet 10.0.0.1 --> 10.0.0.2 netmask 0xffffffff
em0 Локалка
em1 к 3 роутерам
задача
1. мир - настроен как есть ходит через дефаулт гетавей
2. уа-х inet в ету дыру 192.168.0.2 netmask 0xffffff00 broadcast 192.168.0.255
3. в перспективе. может и не потребуется inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
прошу заметить что черес одну сетевую должно пройти 2(3) направления и все заначеные
как писал выше для примера моего старого биллинга хватало следующего
File: firewall.conf
#!/bin/sh
начу по ип а не по интерфейсу
/sbin/natd -u -p 8671 -a 192.168.0.125
/sbin/natd -u -p 8672 -a 192.168.1.140
${FwCMD} add 0500 check-state
уа-х
${FwCMD} add 1099 divert 8672 ip from table\(2\) to table\(11\)
${FwCMD} add 1100 fwd 192.168.1.1 ip from 192.168.1.140 to table\(11\)
${FwCMD} add 1200 divert 8672 ip from any to 192.168.1.140 via sf3
мир
${FwCMD} add 1301 divert 8671 ip from table\(2\) to any
${FwCMD} add 1302 fwd 192.168.0.1 ip from 192.168.0.125 to any
${FwCMD} add 1503 divert 8671 ip from any to 192.168.0.125 via sf0
тут живет высер биллинга
${FwCMD} add 65533 deny all from table\(2\) to any
${FwCMD} add 65534 deny all from any to table\(2\)
пс. мне привезли уже готовый апарат с билленгом и сказали: вот тебе счастье... да вышло только пол-счастья (тк в новой системе пришлось до робочего состояния еще доводить)