首页 > others > Freebsd6 做Nat 网关

Freebsd6 做Nat 网关

2007年3月12日

首先编译内核:

系统: 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做为网关,接入互联网了

分类: others 标签:
本文的评论功能被关闭了.