2 Nic's, 2 Gateways - Limited FreeBSD knowledge

First I am NO expert. I do basics with FreeBSD. I do appreciate the expertise I see in here.

What I am trying to do is have two NICs in one machine, one connects to my "behind the NAT" network with a static IP. The other connects to the router itself with a static IP. I can set both NICs up, however the defaultrouter statement in the rc.conf prevents one of the NICs from seeing its appropriate network. Yes, I know it can be done, but I am getting lost in the "technical" jargon.

Here is my rc.conf lines
Code:
ifconfig_sis0=" inet [I]A.B.C[/I].138 netmask 255.255.255.248"
defaultrouter="[I]A.B.C[/I].137"
ifconfig_re0="inet 192.168.1.252 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
Obviously I changed the A,B and C.

Now I understand that the second defaultrouter line eliminates the sis0 network's gateway and thus make that network non-functional. My question is, what lines do I need in this file to make this desired configuration work and have two NICs with two gateways?

Thanks in advance for any help you can give.
 
Set your default gateway to whatever your ISP told you to use. You don't need one for the 192.168.1.0/24 network because it's a so-called "directly connected" network, i.e. the route to 192.168.1.0/24 is implied because you have an interface in that network.

If traffic needs to be routed you need to enable routing, add this to your rc.conf:
Code:
gateway_enable="YES"
 
Thank you for your reply. My goal is that I want to use the 192.168.1.0/24 network for FTP, SSH, etc. I want the A.B.C.138 network for the world to see the HTTP and not have access to the FTP, SSH, etc. Do I need to enable routing?
 
Put this in your /etc/rc.conf for network configuration

Code:
gateway_enable="YES"
ifconfig_sis0=" inet A.B.C.138 netmask 255.255.255.248"
defaultrouter="A.B.C.137"
ifconfig_re0="inet 192.168.1.252 netmask 255.255.255.0"

and your gateway will be able to communicate with your LAN hosts and your LAN hosts and gateway will be able to communicate with the rest of he world.


Note: Your LAN hosts have to have 192.168.1.252 as their gateway.
 
Back
Top