FreeBSD 7.2 Gateway problem

Please help me :)
I am new in unix so google says if you want to use freebsd as a gateway just type
Code:
gateway_enable="YES"
in /etc/rc.conf :)
well I have a windows XP SP2 computer and it is connected to my ISP directly on static IP protocol, so I use it for a gateway for now but I want to make the BSD machine to gateway (xp is not stable at all).
for now the XP gateway creates an internal network 192.168.0.X
and host a DHCP server so the BSD machine have internet and takes an IP 192.168.0.25.
And the second LAN card of the BSD machine has IP 192.168.1.1 and I want to meke just for the test that a third machine connects to 192.168.1.1 card of the BSD and to be able to rich the 192.168.0.X network.
Well the DHCP server gives me a install error so I use static IP
192.168.1.1 resondes to ping but can't connect any PC in 192.168.0.X network. 192.168.0.1 doestn't respond to ping.
This is the copy of my rc.conf file, I hope there is something little wrong on it and somebody tell me what it is.
Code:
# -- sysinstall generated deltas -- # Sat Nov 14 21:18:11 2009
# Created: Sat Nov 14 21:18:11 2009
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
gateway_enable="YES"
hostname=".mshome.net"
ifconfig_rl0="DHCP"
inetd_enable="YES"
keymap="bg.phonetic.ctrlcaps"
linux_enable="YES"
nfs_client_enable="YES"
nfs_server_enable="YES"
rpcbind_enable="YES"
sshd_enable="YES"
defaultrouter="192.168.0.1"

# -- sysinstall generated deltas -- # Sat Nov 14 22:43:18 2009
router_flags="-s"
router="/sbin/routed"
router_enable="YES"

tcp_extensions="YES"

10x everyone.
 
Yes I can ping 192.168.0.1 and also have internet at all the time
About the routed... I thing after some google search I read a featuere about freebsd routing and there says that I should run this.
I made 1000 tryouts and tests, I try everything I read in google search.
May be it is the remaingings of my trys. And... Shouldn't I run this?
About the second interface I did add an IP adress and subnetmask for it to rc.conf but after a few trys I remove it so I add it manually everytime I boot so I can try diferent things.
If it is a part of the problem... I can add it again anb boot with this settings... And that reminds me about that is the IP and subnetmask enough settings for my needs? Or I should set the gateway and DNS and so on?
because on the 3-th machine at 192.168.1.5 I set the DNS servers given for my ISP and type as a default gateway 192.168.1.1
But at the 192.168.1.1 card what else should I set?
 
You don't need routed.

You do need an IP address and netmask on any interface that you expect to work. [This isn't always true, but it is in your case.] ifconfig() can tell you whether you have them. If you can't figure it out yourself, show us the output from running ifconfig.

You also need forwarding enabled, which is what
Code:
gateway_enable=yes
does.
Code:
sysctl net.inet.ip.forwarding
will show you.
 
The clients in the 192.168.0.0/24 network need a route to the 192.168.1.0/24 network.

If it's windows something like:
Code:
c:\windows> route add 192.168.1.0 mask 255.255.255.0 192.168.0.2

That's assuming your fbsd box has 192.168.0.2.

On your fbsd box set a proper hostname in /etc/rc.conf (.mshome.net isn't). Also remove that inetd line, you really don't want to run that. Also remove those route_ entries unless you plan on running RIP (not really needed with a 'simple' network).
 
OK it works great :) Thank you SirDice, bit this all idea was a test so I can make the FreeBSD machine default gateway(no windows XP routing).
The target idea is :
ISP --->>>(IP given me from ISP)FreeBSD(192.168.1.1) --->>> workstation network(windows machines)
Is that meen I should tell my ISP to run this "route add" so I can run the internal network??
Becos I can run the internal network (192.168.0.X) with windows router without telling anything to my ISP and after that I was able to run another internal network in 192.168.0.X with windows gateway
---> ISP --->>>(IP given mi from ISP)WINDOWS XP(192.168.0.1)--->>>(192.168.0.2)WINDOWS XP(192.168.1.1)--->>> workstation network
and that I was able to do also without touching the 192.168.0.1 machine.
And now you are telling me that if I use for 192.168.1.1 machine FreeBSD then I should make some settings to the 192.168.0.1 machine.
So if I make the 192.168.0.1 machine FreeBSD router, should I tell my ISP to do this settings to their router or something????
 
gnoma said:
Is that meen I should tell my ISP to run this "route add" so I can run the internal network??
No, because 192.168.0.0/16 addresses are defined in RFC-1918 and are not routed on the Internet.

You will probably want to install/run a dhcp server (net/isc-dhcp30-server) and NAT (I use the PF firewall for this). The NAT translates the RFC-1918 addresses to your external Internet IP address. This is basically what ICS does on windows.
 
gnoma said:
OK it works great :) Thank you SirDice, bit this all idea was a test so I can make the FreeBSD machine default gateway(no windows XP routing).
The target idea is :

Code:
ISP --->>>(IP given me from ISP)FreeBSD(192.168.1.1) --->>> workstation network

All you need is NAT on the gateway to translate 192.168.1.x to the external IP address on the other interface, IP forwarding, and the workstations need to use 192.168.1.1 as the gateway. Using DHCP on the internal interface would probably be the easiest way to do that. The ISP doesn't need to do anything; that's what NAT is for.
 
Okay this thank you :) this was usefull but...
I did everything like it is here... http://www.freebsd.org/doc/en/books/handbook/network-natd.html Modifying the kernel like it is here... http://www.freesoftwaremagazine.com/articles/writing_a_kernel_module_for_freebsd, I did everything by the book and it is on a fresh FreeBSD installation from this morning.
Code:
ipfw_load="YES"
ipdivert_load="YES"
net.inet.ip.fw.default_to_accept="1"



file "/boot/loader.conf", 3 lines

Code:
# -- sysinstall generated deltas -- # Wed Nov 25 18:07:56 2009
# Created: Wed Nov 25 18:07:56 2009
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
defaultrouter="92.247.11.97"
gateway_enable="YES"
firewall_enable="YES"
firewall_type="OPEN"
natd_enable="YES"
natd_interface="em0"
ifconfig_em0="inet 92.247.11.115  netmask 255.255.255.224"
ifconfig_rl0="inet 192.168.1.1 netmask 255.255.255.0"
#inetd_enable="YES"
linux_enable="YES"
sshd_enable="YES"



file "/etc/rc.conf", 17 lines

Code:
#
# GENERIC -- Generic kernel configuration file for FreeBSD/i386
#
# For more information on this file, please read the handbook section on
# Kernel Configuration Files:
#
#    [url]http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-conf[/url]
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server ([url]http://www.FreeBSD.org/[/url]) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.#
# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.474.2.17.2.1 2009/04/15 03:14:26 kensm

cpu             I486_CPU
cpu             I586_CPU
cpu             I686_CPU
ident           GENERIC

# To statically compile in device wiring instead of /boot/device.hints
#hints          "GENERIC.hints"         # Default places to look for devices.

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         INET6                   # IPv6 communications protocols
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         MD_ROOT                 # MD is a potential root device
options         NFSCLIENT               # Network Filesystem Client
options         NFSSERVER               # Network Filesystem Server
options         NFSLOCKD                # Network Lock Manager
options         NFS_ROOT                # NFS usable as /, requires NFSCLIENT
options         MSDOSFS                 # MSDOS Filesystem
options         CD9660                  # ISO 9660 Filesystem
options         PROCFS                  # Process filesystem (requires PSEUDOFS)
options         PSEUDOFS                # Pseudo-filesystem framework
options         GEOM_PART_GPT           # GUID Partition Tables.
options         GEOM_LABEL              # Provides labelization
options         COMPAT_43TTY            # BSD 4.3 TTY compat [KEEP THIS!]
options         COMPAT_FREEBSD4         # Compatible with FreeBSD4
options         COMPAT_FREEBSD5         # Compatible with FreeBSD5
options         COMPAT_FREEBSD6         # Compatible with FreeBSD6
options         SCSI_DELAY=5000         # Delay (in ms) before probing SCSI
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         _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extension
options         KBD_INSTALL_CDEV        # install a CDEV entry in /dev
options         ADAPTIVE_GIANT          # Giant mutex is adaptive.
options         STOP_NMI                # Stop CPUS using NMI instead of IPI
options         AUDIT                   # Security event auditing
options         IPFIREWALL              # No *beep**beep**beep**beep*in idea
options         IPDIVERT                # No *beep**beep**beep**beep*in idea
options         IPFIREWALL_DEFAULT_TO_ACCEPT #No *beep**beep**beep**beep*in idea
options         IPFIREWALL_VERBOSE      # No *beep**beep**beep**beep*in idea
#options        KDTRACE_HOOKS           # Kernel DTrace hooks

# To make an SMP kernel, the next two lines are needed
options         SMP                     # Symmetric MultiProcessor Kernel
device          apic                    # I/O APIC


File: sys/i386/conf/CUSTOM
and so on.......... no changes sens
those 4 with comment "no *beep**beep**beep**beep*in idea" wich was added by me
then:
cd /usr/src
make buildkernel KERNCONF="CUSTOM"
(no errors)
make installkernel KERNCONF="CUSTOM"
(no errors)
reboot

And still nothing. I set a static IP 192.168.1.101 on a windows mchine, set the gatweay and subnetmask and everything and still ping only to 192.168.1.1 and 92.247.11.115. Nowhere else ping respond!
Do I totaly wrong somewhere something??? Or it is the usual way of learning things???


P.S.
About the DHCP Server.. I'll deal with it leater, for now it is not a problem to set a static IP on a fiew workstations just for the moment so I can run the damn network.
 
Code:
ifconfig_em0="inet 92.247.11.115  netmask 255.255.255.224"
ifconfig_rl0="inet 192.168.1.1 netmask 255.255.255.0"

How come you're using a static ip address and a netmask of 255.255.255.224? Unless your ISP has given you a static IP addres you should set it to ifconfig_em0="DHCP". Do you have DNS configured for your XP box?
 
My ISP gives me a static IP not DHCP :) this is Bulgaria dude :p
Here they ivent work with PPPOE and make a MAC adress restrictions so if you change your LAN card you have to call them.
And about the DNS, they are OK :)
From the BSD machine I have ping to every IP or domain in internet.
I don't know what I did but I reinstall FreeBSD and make the same settings and the damn NAT start normaly so my network is OK now... today I'll try to do some port forwarding and install DHCP server.
By the way anybody knows why I can't connect the BSD NFS with windows client (windows explorer) ???????
 
gnoma said:
By the way anybody knows why I can't connect the BSD NFS with windows client (windows explorer) ???????
Windows doesn't support NFS (by default anyway). There are a few commercial NFS clients for Windows and a few free ones. It's simpler to install net/samba33 and use CIFS/SMB file/printer sharing.
 
OK then what is a shared folder or partition in windows???
And can I make a folder in freebsd to act the same way in a network???
I meen I want to be able to open a file without downloading it like with FTP, a movie for example.
 
what you need is to read up on pf

I personally use pf for the firewall/NAT stuff and dnsmasq for the dhcp and authoritative dns.
 
Back
Top