当前位置: 首页 > others > 正文

Freebsd6 做Nat 网关

首先编译内核:

系统: Freebsd6.0

双网卡:

config mykernel

cd ../compile/mykernel

make depend

make

make install

BSD# cd /usr/local/etc/rc.d/runipnat.sh

BSD# vi runipnat.sh

#!/bin/sh

/sbin/ipnat -f /etc/ipnat.conf

#chmod 755 /usr/local/etc/rc.d/runipnat.sh

设置自动启动

BSD# more /etc/ipnat.conf

map vr0 192.168.100.0/24 -> 192.168.1.35/32 portmap tcp/udp 10000:65000

map vr0 192.168.100.0/24 -> 192.168.1.35/32

vi /etc/rc.conf

# — sysinstall generated deltas — # Mon Jan 29 15:59:39 2007

defaultrouter=”192.168.1.1″

hostname=”BSD.gatway”

ifconfig_vr0=”inet 192.168.1.35 netmask 255.255.255.0″

usbd_enable=”YES”

sshd_enable=”YES” # Enable sshd

sshd_program=”/usr/sbin/sshd” # path to sshd, if you want a different one.

sendmail_enable=”NO” # Run the sendmail inbound daemon (YES/NO).

blanktime=”NONE” # blank time (in seconds) or “NO” to turn it off.

# — sysinstall generated deltas — # Mon Jan 29 23:10:15 2007

ifconfig_rl0=”inet 192.168.100.1 netmask 255.255.255.0″

hostname=”BSD.gatway”

gateway_enable=”YES”

named_enable=”YES”

natd_enable=”YES”

natd_interface=”vr0″

说明 vr0 是外网网卡

其他的机器上可以使用192.168.100.1做为网关,接入互联网了

本文固定链接: https://www.2hei.net/2007/03/12/freebsd6-%e5%81%9anat-%e7%bd%91%e5%85%b3/ | 2hei.net

该日志由 u2 于2007年03月12日发表在 others 分类下,
原创文章转载请注明: Freebsd6 做Nat 网关 | 2hei.net

报歉!评论已关闭.