Jump to content

Recommended Posts

Posted

Часов тридцать угробил...

 

Ситуация: сеть, 7 машин, один внешний ip

Надо чтобы ipfw show показывал правила по которым входящий и исходящий трафик считается - 2 правила на каждого пользователя, плюс общие правила на каждый доступный изнутри порт (80,21,25,110....)

Вот _почти_ весь скрипт... на сервере еще кое-что менял. но не работал (сбросил обратно)

 

 

 

 

#!/bin/sh

# Define path to ipfw

fwcmd='/sbin/ipfw -q'

 

# Inside network

in_net='192.168.5.0/24'

 

# Prefix for inside net

in_prefix='192.168.5'

 

# Outside and inside interfaces

ifout='rl0'

ifin='rl1'

 

# Outside and inside ip's

out_ip='212.23.50.93'

in_ip='192.168.5.30'

 

# activate stateful firewall

${fwcmd} 00100 check-state

 

# deny icmp

${fwcmd} 00200 deny icmp from any to any in icmptype 5,9,13,14,15,16,17

 

# allow ssh from home

${fwcmd} 01010 allow ip from 212.23.59.176 to ${out_ip} dst-port 22 via ${ifout}

${fwcmd} 01020 allow ip from ${out_ip} 22 to 212.23.59.176 via ${ifout}

 

# allow ssh from office

${fwcmd} 01010 allow ip from ${in_net} to ${in_ip} dst-port 22 via ${ifin}

${fwcmd} 01020 allow ip from ${in_ip} 22 to ${in_net} via ${ifin}

 

${fwcmd} 05030 divert natd ip from ${in_prefix}.1 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05032 divert natd ip from ${in_prefix}.2 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05034 divert natd ip from ${in_prefix}.3 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05036 divert natd ip from ${in_prefix}.4 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05038 divert natd ip from ${in_prefix}.5 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05040 divert natd ip from ${in_prefix}.6 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05042 divert natd ip from ${in_prefix}.7 to not ${in_prefix}.0/24 out xmit ${ifout}

${fwcmd} 05043 divert natd ip from any to ${out_ip} in recv ${ifout}

${fwcmd} 10000 allow ip from any to any via lo0

${fwcmd} 10100 deny ip from any to 127.0.0.0/8

${fwcmd} 10200 deny ip from 127.0.0.0/8 to any

${fwcmd} 65000 allow ip from any to any

${fwcmd} 65100 allow icmp from ${out_ip} to any out via ${ifout} icmptypes 3,8,12

${fwcmd} 65200 allow icmp from ${out_ip} to any out via ${ifout} frag

 

 

Заранее спасибо за советы и критику.. и за ССЫЛКИ тоже.. только не на оупеннет :- т.к. там не нашел.. у всех почти идет ${fwcmd} add divert natd from any to any via ${ext_iface}

Posted

Чесно говоря не совсем уверен что правильно понял вопрос. В чём собственно проблема-то?

Ты что хочешь при помощи IPFW трафик считать чтоли?

ИМХО не правильно это, да и в книгах про это наисано. Есть ведь нормальные "легкие" считалки, trafd например.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...
На сайте используются файлы cookie и сервисы аналитики для корректной работы форума и улучшения качества обслуживания. Продолжая использовать сайт, вы соглашаетесь с использованием файлов cookie и с Политикой конфиденциальности.