Инструменты пользователя

Инструменты сайта


wiki:freebsd:ipfw

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
wiki:freebsd:ipfw [2024/01/07 14:59] – [Включение ipfw] Dimanwiki:freebsd:ipfw [2024/01/29 14:41] (текущий) Diman
Строка 26: Строка 26:
 pkg update && pkg upgrade pkg update && pkg upgrade
  
-pkg install -y mc nano rsync screen tmux bash htop +pkg install -y mc nano rsync  tmux bash htop bind-tools
  
 # replace bash for root # replace bash for root
Строка 44: Строка 44:
 ipfw_nat_load="YES" ipfw_nat_load="YES"
 firewall_logif="YES" firewall_logif="YES"
 +# PIPE + dummynet
 ipdivert_load="YES" ipdivert_load="YES"
 dummynet_load="YES" dummynet_load="YES"
Строка 51: Строка 51:
 net.fibs="4"' >> /boot/loader.conf net.fibs="4"' >> /boot/loader.conf
  
 +</code>
 +
 +==== Работающий в первый же запуск скрипт ipfw ====
 +
 +<code bash>
 echo '#!/usr/local/bin/bash echo '#!/usr/local/bin/bash
    
Строка 61: Строка 66:
 $cmd add deny all from 127.0.0.0/8 to any $cmd add deny all from 127.0.0.0/8 to any
 $cmd add deny all from any to any frag $cmd add deny all from any to any frag
-  +
-$cmd add check-state +
-$cmd add allow tcp from any to any established +
-$cmd add allow all from any to any out keep-state +
- +
 # ssh # ssh
 $cmd table admin create missing $cmd table admin create missing
 $cmd table admin add 10.1.1.0/24 $cmd table admin add 10.1.1.0/24
 $cmd table admin add 192.168.10.0/24 $cmd table admin add 192.168.10.0/24
 + 
 +$cmd add check-state
 +#$cmd add allow tcp from any to any established
 +$cmd add allow all from any to any out keep-state
  
 $cmd add allow ip from "table(admin)" to me 22 $cmd add allow ip from "table(admin)" to me 22
-  
-# HTTP && HTTPS 
-$cmd add allow tcp from any to me 443 in limit src-addr 50 
-$cmd add allow tcp from any to me 80 in limit src-addr 20 
-  
-# Mail 
-$cmd add allow tcp from me to any 25 out 
-$cmd add allow tcp from any 25 to me in 
    
 # Ping # Ping
 $cmd add allow icmp from "table(admin)" to me in icmptype 8 $cmd add allow icmp from "table(admin)" to me in icmptype 8
 $cmd add allow icmp from me to "table(admin)" out icmptype 0,8 $cmd add allow icmp from me to "table(admin)" out icmptype 0,8
 + 
 $cmd add allow all from any to any $cmd add allow all from any to any
- 
 $cmd add deny log all from any to any' > /etc/ipfw.script $cmd add deny log all from any to any' > /etc/ipfw.script
  
Строка 93: Строка 89:
 sysrc firewall_logging="YES" sysrc firewall_logging="YES"
  
 +</code>
 +
 +==== NTPd ====
 +
 +<code bash>
 +# ntpd
 +echo '# NTP
 +
 +server ntp.ix.ru iburst maxpoll 9 prefer
 +server ntp2.aas.ru iburst maxpoll 9
 +server 0.freebsd.pool.ntp.org iburst maxpoll 9
 +server 1.freebsd.pool.ntp.org iburst maxpoll 9
 +
 +restrict default ignore
 +
 +restrict 127.0.0.1
 +restrict ntp.ix.ru
 +restrict ntp2.aas.ru
 +restrict 0.freebsd.pool.ntp.org
 +interface ignore wildcard
 +interface listen igb0
 +
 +logfile /var/log/ntp.log
 +driftfile /var/db/ntp.drift
 +' > /etc/ntp.conf
 +
 +touch /var/db/ntp.drift
 +touch /var/log/ntp.log
 +
 +sysrc ntpd_enable="YES"
 +sysrc ntpdate_enable="YES"
 +sysrc ntpdate_hosts="127.0.0.1"
 +sysrc ntpd_sync_on_start="NO"
 +
 +service ntpd start
  
 </code> </code>
  
 +==== Включение NAT ====
 +
 +
 +<code bash>
 +
 +sysrc gateway_enable="YES"
 +
 +</code>
  
  
wiki/freebsd/ipfw.1704628784.txt.gz · Последнее изменение: 2024/01/07 14:59 — Diman

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki