FreeBSD网关完整配置
时间:2007-01-04 10:28:22
来源: 作者:whsong 点击:次 出处:技术无忧
关键字:Free
1.装5.4 ,ports中装linux兼容包2.配置rl0网卡地址
teczm#ee /etc/rc.conf
加入
ifconfig_rl0="inet 192.168.7.1 netmask 255.255.255.0"
ifconfig_rl0_alias0="inet 192.168.8.1 netmask 255.255.255.0"
保存退出。
3.编译内核
#cd /usr/src/sys/i386/conf
#cp GENERIC MYKERNEL
#ee MYKERNEL
加入
1)ipfw防火墙支持
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=5
2)nat支持
options IPFIREWALL(前面已加)
options IPDIVERT
options IPFIREWALL_VERBOSE(前面已加)
保存退出。
#以下为内核编译命令
teczm#/usr/sbin/config MYKERNEL
teczm#cd ../compile/MYKERNEL
teczm#make depend
teczm#make
teczm#make intsall
4.修改/etc/rc.conf
加入:
gateway_enable="YES" #机器设为网关
firewall_enable="YES" #启动时在/etc/rc.firewall中启用防火墙规则
firewall_type="OPEN"
natd_enable="YES" #natd允许运行
natd_interface="sis0" #sis0是外网网卡名称
natd_flags="" #在启动时通过natd的任何额外选项
5.中文化
把这两句内容加到/etc/csh.cshrc
setenv LANG en_GB.ISO8859-1
setenv LC_ALL en_GB.ISO8859-1
6.配置防火墙
teczm#ee /etc/rc.firewall在最后加入
ipfw add allow all from any to any via lo0
ipfw add allow all from any to me via rl0
ipfw add deny icmp from any to me icmptypes 8
ipfw add allow udp from any 53 to me via tun0
ipfw add deny tcp from any to me setup
ipfw add allow all from any to any
7.pppoe设置
7.1. 编辑/etc/ppp/ppp.conf
default:
set log Phase tun command
set ifaddr 10.0.0.1/0 10.0.0.2/0
isp: (这个名字可自定义)
set device PPPoE:rl0
set authname NAME
set authkey PASSWORD
set dial
set login
nat enable yes #注意此句一定要打开,否则没法NAT;若不使用此句,需在/etc/rc.conf中加入ppp_nat="YES"
enable dns #如果不加这一句,则需要在/etc/resolv.conf中设定ISP提供的dns地址
add default HISADDR
7.2编辑/etc/rc.conf
加入
ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="YES" (这句开启nat外网功能,如果/etc/ppp/ppp.conf中有nat enable yes这句,此行可去掉)
ppp_profile="isp"
8.#shutdown -r now
9.优化sshd_config
待续....












文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面