Конфигурация сети:
ed0 смотрит в мир, DHCp
rl0 смотрит в LAN
конфиг ядра:
Код: Выделить всё
cpu I686_CPU
ident GATEWAY
# To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" # Default places to look for devices.
# env "GENERIC.env"
makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
options SCHED_ULE # ULE scheduler
options PREEMPTION # Enable kernel thread preemption
options INET # InterNETworking
options SCTP # Stream Control Transmission Protocol
options FFS # Berkeley Fast Filesystem
options SOFTUPDATES # Enable FFS soft updates support
options UFS_ACL # Support for access control lists
options UFS_DIRHASH # Improve performance on big directories
options UFS_GJOURNAL # Enable gjournal-based UFS journaling
options PROCFS # Process filesystem (requires PSEUDOFS)
options PSEUDOFS # Pseudo-filesystem framework
options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_LABEL # Provides labelization
options KTRACE # ktrace(1) support
options STACK # stack(9) support
options SYSVSHM # SYSV-style shared memory
options SYSVMSG # SYSV-style message queues
options SYSVSEM # SYSV-style semaphores
options P1003_1B_SEMAPHORES # POSIX-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed.
options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
options AUDIT # Security event auditing
options MAC # TrustedBSD MAC Framework
options FLOWTABLE # per-cpu routing cache
#options KDTRACE_HOOKS # Kernel DTrace hooks
options INCLUDE_CONFIG_FILE # Include this file in kernel
options KDB # Kernel debugger related code
options KDB_TRACE # Print a stack trace for a panic
device pci
device ata
device atadisk # ATA disk drives
options ATA_STATIC_ID # Static device numbering
# atkbdc0 controls both the keyboard and the PS/2 mouse
device atkbdc # AT keyboard controller
device atkbd # AT keyboard
device kbdmux # keyboard multiplexer
device vga # VGA video card driver
# syscons is the default console driver, resembling an SCO console
device sc
# Add suspend/resume support for the i8254.
device pmtimer
device ppc
device ppbus # Parallel port bus (required)
device ppi # Parallel port interface device
device miibus # MII bus support
device rl # RealTek 8129/8139
device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards
# Pseudo devices.
device loop # Network loopback
device random # Entropy device
device ether # Ethernet support
device pty # BSD-style compatibility pseudo ttys
device firmware # firmware assist module
device bpf # Berkeley packet filter
#CYRIX OPTIONS
option CPU_WT_ALLOC
option CYRIX_CACHE_REALLY_WORKS
#IPFW AND KERNEL NAT
option IPFIREWALL
option IPFIREWALL_VERBOSE
option IPDIVERT
option IPFIREWALL_FORWARD
option DUMMYNET
option IPFIREWALL_NAT
option LIBALIAS
Код: Выделить всё
gateway_enable="YES"
hostname="gateway"
ifconfig_rl0="inet 192.168.0.1 netmask 255.255.255.0"
ifconfig_ed0="ether 00:a0:d2:12:5b:e0"
ifconfig_ed0="DHCP"
keymap="ua.koi8-u.shift.alt"
firewall_enable="YES"
firewall_script="/etc/ipfw.sh"
sshd_enable="YES"
natd_enable="YES"
natd_interface="ed0"
natd_flags=""
Код: Выделить всё
#!/bin/sh
ipfw -q flush
ipfw add 10 allow all from any to any
pifw add 20 divert natd all from any to any via ed0