分享
 
 
 

在NETBSD上配置ADSL+IPF+IPNAT

王朝other·作者佚名  2008-05-21
窄屏简体版  字體: |||超大  

OS: 2.x

配置网卡的IP地址:

# vi /etc/ifconfig.rtk0

inet 192.168.0.1 netmask 255.255.255.0

# vi /etc/ifconfig.tlp0

inet 192.168.1.2 netmask 255.255.255.0

配置主机名:

# vi /etc/myname

netbsd

# vi /etc/hosts

127.0.0.1

localhost

netbsd

配置DNS解析:

# vi /etc/resolv.conf

nameserver 202.99.160.68

nameserver 202.99.168.8

配置网关:

# vi /etc/mygate

192.168.0.10

配置主机本地解析:

# vi /etc/hosts

192.168.0.10

win2k

配置SSHD服务:

# vi /etc/defaults/rc.conf

sshd=YES

# vi /etc/ssh/sshd_config

PermitRootLogin yes

安装配置ADSL:

# pkg_add rp-pppoe-3.5.tgz

# mkdir /etc/ppp

# cp /usr/pkg/share/examples/rp-pppoe/pppoe.conf /etc/ppp/pppoe.conf

# adsl-start

配置防火墙代理上网:

# vi /etc/ipf.conf

=================================/etc/ipf.conf==============================

# +-----------+

+------------------------------+

+------------------+

# | ADSL-Modem|---| ppp0 tlp0

NAT+IPF

rtk0 |---| Internal Network |

# +-----------+

+------------------------------+

+------------------+

#

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# Interface: all

# Block all incoming and outgoing packets unless they're allowed later.

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

block in all

block out all

# Possibly dangerous: packets with ip-options, short and fragmented packets

block in log quick on ppp0 proto icmp from any to any

block in log quick all with short

block in log quick all with ipopts

block in log quick all with frag

block in log quick all with opt lsrr

block in log quick all with opt ssrr

# Local network traffic is allowed

pass out quick on lo0

pass in quick on lo0

pass out quick on rtk0

pass in quick on rtk0

# Block faked or unlikely "local" addresses

block in log body quick on ppp0 from 192.168.0.0/16 to any

block in log body quick on ppp0 from 172.16.0.0/12 to any

block in log body quick on ppp0 from 10.0.0.0/8 to any

block in log body quick on ppp0 from 192.0.2.0/24 to any

block in log body quick on ppp0 from 0.0.0.0/8 to any

block in log body quick on ppp0 from 127.0.0.0/8 to any

block in log body quick on ppp0 from 169.254.0.0/16 to any

block in log body quick on ppp0 from 224.0.0.0/3 to any

block in log body quick on ppp0 from 204.152.64.0/23 to any

# Blocking of outgoing faked or unlikely "internal" addresses

block out log body quick on ppp0 from any to 192.168.0.0/16

block out log body quick on ppp0 from any to 172.16.0.0/12

block out log body quick on ppp0 from any to 10.0.0.0/8

block out log body quick on ppp0 from any to 127.0.0.0/8

block out log body quick on ppp0 from any to 0.0.0.0/8

block out log body quick on ppp0 from any to 169.254.0.0/16

block out log body quick on ppp0 from any to 192.0.2.0/24

block out log body quick on ppp0 from any to 204.152.64.0/23

block out log body quick on ppp0 from any to 224.0.0.0/3

# The pass rules to enable Services

pass in on ppp0 proto tcp from any to any port = 20 flags S keep state

pass in on ppp0 proto tcp from any to any port = 21 flags S keep state

pass in on ppp0 proto tcp from any to any port = 22 flags S keep state

pass in on ppp0 proto tcp from any to any port = 25 flags S keep state

pass in on ppp0 proto tcp from any to any port = 80 flags S keep state

pass in on ppp0 proto tcp from any to any port = 110 flags S keep state

pass in on ppp0 proto tcp from any to any port = 443 flags S keep state

pass in on ppp0 proto tcp from any to any port 55000 >;< 56000 flags S keep state

# The general pass rules.

pass out quick on ppp0 proto tcp from any to any flags S/SAFR keep state keep frags

pass out quick on ppp0 proto udp from any to any keep state keep frags

pass out quick on ppp0 proto icmp from any to any keep state keep frags

=================================/etc/ipf.conf==============================

# vi /etc/sysctl.conf

net.inet.ip.forwarding=1

net.inet.tcp.mss_ifmtu=1

# vi /etc/ipnat.conf

map ppp0 192.168.0.0/24 ->; 0/32 proxy port ftp ftp/tcp mssclamp 1440

map ppp0 192.168.0.0/24 ->; 0/32 portmap tcp/udp auto mssclamp 1440

map ppp0 192.168.0.0/24 ->; 0/32 mssclamp 1440

启用防火墙设置:

# vi /etc/defaults/rc.conf

ipfilter=YES

# uses /etc/ipf.conf

ipnat=YES

# uses /etc/ipnat.conf

ipfs=YES

ipfs_flags=""

# save/load ipnat and ipf states

ifwatchd=YES

配置动态域名更新:

# wget http://www.3322.org/dyndnspage/ez-ipupdate-3.0.10.tgz

# 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

";

//

}

# ./configure

# make

# make install

设置拨号后自动运行:

# vi /etc/ppp/ip-up

#!/bin/sh

/usr/local/bin/ez-ipupdate -i ppp0 -h nero.3322.org -S qdns -u llzqq:9335333

# chmod 700 /etc/ppp/ip-up

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有