亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術(shù)文章
文章詳情頁

OPENBSD上的ADSL和防火墻設(shè)置配置

瀏覽:260日期:2022-06-03 13:52:57
下面我用的是OPENBSD 3.6

配置ADSL:
# vi /etc/ppp/ppp.conf
========================ppp.conf=======================
default:
set log Phase Chat IPCP CCP tun command
set redial 15 0
set reconnect 15 10000

pppoe:
set device "!/usr/sbin/pppoe -i rl1"
disable acfcomp protocomp
deny acfcomp
set mtu max 1492
set crtscts off
set speed sync
enable lqr
set lqrperiod 5
set cd 5
set dial
set login
set timeout 0
set authname "sjz681a0156@adsl2"
set authkey 123456
add! default HISADDR
enable mssfixup
========================ppp.conf=======================

建立防火墻代理配置:
# vi /etc/pf.conf
=========================pf.conf=======================
ext_if = "tun0"
int_if = "{ dc0, rl0 }"
int_net = "{ 192.168.0.0/24, 192.168.10.0/24 }"
loop = "lo0"
tcp_services = "{ www, ftp }"
boss_ip = "{ 192.168.10.10, 192.168.10.11, 192.168.10.12, 192.168.10.13, 192.168.10.14, 192.168.10.15 }"
noroute = "{ 127.0.0.1/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8, 255.255.255.255/32 }"
web_server = "{ 192.168.10.5, 192.168.100.16 }"
set block-policy return
set loginterface $ext_if

set optimization aggressive

scrub in all

altq on $int_if cbq bandwidth 1200Kb queue { dflt, boss }
queue dflt bandwidth 300Kb cbq(default)
queue boss bandwidth 900Kb cbq(borrow)

nat on $ext_if from $int_net to any -> $ext_if

block all

block return
block in quick on $ext_if os NMAP
block in quick on $ext_if from $noroute to any
block out quick on $ext_if from any to $noroute

pass in quick on $ext_if inet proto tcp from any to any port > 60000 keep state
#pass in quick on $ext_if inet proto icmp all icmp-type 8 code 0 keep state
pass in quick on $ext_if inet proto tcp from any to any port $tcp_services flags S/SAFR keep state

pass quick on $loop all
pass in on $int_if from $int_net
pass out on $int_if from any to $int_net
pass out on $int_if from any to $boss_ip queue boss
pass out on $ext_if all keep state

pass in on $ext_if inet proto tcp from any to $web_server port = 80 flags S/SAFR keep state (max 200, source-track rule, max-src-nodes 200, max-src-states 2) queue boss
=========================pf.conf=======================

禁用系統(tǒng)自定義的PF規(guī)則

# vi /etc/rc.conf
pf=NO

啟用IP轉(zhuǎn)發(fā):
# vi /etc/sysctl.conf
net.inet.ip.forwarding=1

設(shè)置開機啟動ADSL撥號:

# mkdir /etc/rc.d
# vi /etc/rc.d/adsl.sh
--------------+----------------+---------------+-------------
#!/bin/sh
# /etc/rc.d/adsl.sh
# 7-11-2004
# llzqq@126.com

pppoe_status () {

IP=$(/sbin/ifconfig tun0 | awk "/netmask/{print $2}")

if [ ! -z "$IP" ]; then
echo "pppoe link is up, ip: " $IP
else
echo "pppoe link is down"
fi
}

pppoe_start () {

echo -n "starting pppoe "; ppp -ddial pppoe > /dev/null

for i in 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0; do
sleep 2; echo -n "."
IP=$(/sbin/ifconfig tun0 | awk "/netmask/{print $2}")
if [ ! -z "$IP" ]; then
break
fi
done
echo "."
pppoe_status
}

pppoe_stop () {

PID=$(ps aux | awk "/ppp -ddial/{print $2}")
kill $PID
echo "pppoe link is down"
}

case "$1" in
"start")
pppoe_start
;;
"stop")
pppoe_stop
;;
"status")
pppoe_status
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
esac
--------------+----------------+---------------+-------------
# chmod 555 /etc/rc.d/adsl.sh

開機時自動進行ADSL撥號

# vi /etc/rc.local

if [ -f /etc/ppp/ppp.conf ]; then
. /etc/rc.d/adsl.sh start
fi

# vi /etc/rc.shutdown
/etc/rc.d/adsl.sh stop

啟用NAME緩存服務(wù)器(不是必須的):
# vi /var/named/named.boot
options forward-only
forwarders 202.99.160.68 202.99.168.8

根據(jù)撥號需要加載和關(guān)閉防火墻:
# vi /etc/ppp/ppp.linkup
MYADDR:
! sh -c "/sbin/ifconfig pflog0 up"
! sh -c "/sbin/pflogd"
! sh -c "/sbin/pfctl -e -F all -f /etc/pf.conf"

# vi /etc/ppp/ppp.linkdown
MYADDR:
! sh -c "/sbin/pfctl -d -F all"
! sh -c "kill `cat /var/run/pflogd.pid`"
! sh -c "/sbin/ifconfig pflog0 down"
! sh -c "/sbin/route delete default"

配置動態(tài)域名更新:

# tar zxvf ez-ipupdate-3.0.10.tgz
# cd ez-ipupdate-3.0.10
# vi conf_file.c
增加一行:
#include <errno.h>

# vi ez-ipupdate.c
注釋掉下面幾行(4515行):
//else
// {
// fprintf(stderr, "no update needed at this time\n");
// }

# ./configure
# make
# make install

設(shè)置撥號后自動運行:

# vi /etc/ppp/ppp.linkup
MYADDR:
! sh -c "/sbin/ifconfig pflog0 up"
! sh -c "/sbin/pflogd"
! sh -c "/sbin/pfctl -e -F all -f /etc/pf.conf"
!bg /usr/local/bin/ez-ipupdate -i tun0 -h nero.3322.org -S qdns -w wildcard -u user:pwd

解決通過PF防火墻用主動模式連接外網(wǎng)FTP服務(wù)器的問題:

# vi /etc/pf.conf
rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021

# vi /etc/inetd.conf
127.0.0.1:8021 stream tcp nowait root /usr/libexec/ftp-proxy ftp-proxy

# reboot

設(shè)置SQUID的透明代理:

# vi /etc/squid/squid.conf
http_port 127.0.0.1:3128

# vi /etc/pf.conf
rdr on $int_if proto tcp from $int_net to any port 80 -> 127.0.0.1 port 3128
相關(guān)文章:
主站蜘蛛池模板: 国产精品喷水在线观看 | 在线欧美亚洲 | 国产91精品在线播放 | 国产精品亚洲二区在线 | 欧美啪啪网站 | 嫩草视频在线观看免费 | 色综合图区 | 91制服丝袜| 欧美系列在线播放 | 亚洲综合视频一区 | 黄色一级国产 | 亚洲精品一级片 | 亚洲一区二区色 | 日本一视频一区视频二区 | 国产视频1区 | 日日夜夜免费精品视频 | 大尺度一级毛片波多野结衣 | 国产美女免费视频 | 久久国产精品影院 | www·麻豆| 9l国产精品久久久久麻豆 | 狠狠色丁香婷婷久久综合考虑 | 一级特黄aaaaaa大片 | 国精品日韩欧美一区二区三区 | 欧美日韩综合精品一区二区三区 | 免费永久在线观看黄网 | 九九视频高清视频免费观看 | 午夜激情视频在线观看 | 亚洲欧美综合一区二区三区四区 | 亚洲精品乱码久久久久久 | 免费国产成人手机在线观看 | 亚洲小younv另类| 免费一级毛片 | 九一在线完整视频免费观看 | 免费看在线爱爱小视频 | 免费又黄又粗又爽大片 | 欧美成人免费毛片 | 中国一级毛片录像 | 欧美成人h精品网站 | 伊人久久婷婷丁香六月综合基地 | 亚洲人成s大片在线播放 |