- Старая как world задача о пробросе портов, 1 шт.
- Болван, 1 шт.
Код: Выделить всё
...
options LIBALIAS
options IPFIREWALL
options IPFIREWALL_NAT
options IPFIREWALL_FORWARD
options IPFIREWALL_VERBOSE
...
Код: Выделить всё
sysctl net.inet.ip.fw.one_pass=0
Есть такой rc.firewall (немного видоизмененный):
Код: Выделить всё
outer_if="re0"
outer_ip="123.45.6.78" # Ну-у...
inner_if="sk0"
inner_ip="192.168.0.234"
rdserver="192.168.0.206"
rdclient="78.6.45.123" # Ну-у...
fw="/sbin/ipfw -q"
${fw} -f flush
${fw} nat 1 config ip ${inner_ip} redirect_addr ${rdserver} ${outer_ip} log
${fw} add nat 1 tcp from ${rdclient} to ${outer_ip} rdp via ${out_if}
${fw} add pass all from any to any via lo0
${fw} add deny all from ${inner_nw} to any via ${outer_if}
${fw} add pass tcp from any to any established
...
${fw} add deny log tcp from any to any
Код: Выделить всё
kernel: ipfw: 100 Nat TCP 78.6.45.123:1637 123.45.6.78:3389 in via re0
last message repeated 2 times
kernel: ipfw: 100 Nat TCP 78.6.45.123:1638 123.45.6.78:3389 in via re0
last message repeated 2 times
Код: Выделить всё
listening on re0, link-type EN10MB (Ethernet), capture size 96 bytes
IP 78.6.45.123.1637 > 123.45.6.78.rdp: S 1319421240:1319421240(0) win 65535 <mss 1460,nop,nop,sackOK>
IP 78.6.45.123.1637 > 123.45.6.78.rdp: S 1319421240:1319421240(0) win 65535 <mss 1460,nop,nop,sackOK>
IP 78.6.45.123.1637 > 123.45.6.78.rdp: S 1319421240:1319421240(0) win 65535 <mss 1460,nop,nop,sackOK>
IP 78.6.45.123.1638 > 123.45.6.78.rdp: S 1319421240:1319421240(0) win 65535 <mss 1460,nop,nop,sackOK>
IP 78.6.45.123.1638 > 123.45.6.78.rdp: S 1319421240:1319421240(0) win 65535 <mss 1460,nop,nop,sackOK>
IP 78.6.45.123.1638 > 123.45.6.78.rdp: S 1319421240:1319421240(0) win 65535 <mss 1460,nop,nop,sackOK>
listening on re0, link-type EN10MB (Ethernet), capture size 96 bytes
