下面我用的是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=======================
禁用系统自定义的PF规则
# vi /etc/rc.conf
pf=NO
启用IP转发:
# vi /etc/sysctl.conf
net.inet.ip.forwarding=1
设置开机启动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缓存服务器(不是必须的):
# vi /var/named/named.boot
options forward-only
forwarders 202.99.160.68 202.99.168.8
根据拨号需要加载和关闭防火墙:
# 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"
配置动态域名更新:
# 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
设置拨号后自动运行:
# 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防火墙用主动模式连接外网FTP服务器的问题:
# 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
设置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
配置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=======================
禁用系统自定义的PF规则
# vi /etc/rc.conf
pf=NO
启用IP转发:
# vi /etc/sysctl.conf
net.inet.ip.forwarding=1
设置开机启动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缓存服务器(不是必须的):
# vi /var/named/named.boot
options forward-only
forwarders 202.99.160.68 202.99.168.8
根据拨号需要加载和关闭防火墙:
# 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"
配置动态域名更新:
# 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
设置拨号后自动运行:
# 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防火墙用主动模式连接外网FTP服务器的问题:
# 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
设置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
标签:
OPENBSD,ADSL,防火墙
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“OPENBSD上的ADSL和防火墙设置配置”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
2024年11月23日
2024年11月23日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]