# Lan to Lan Routing



## tsyselsky (Aug 13, 2010)

I want to configure the routing of the subnet LAN1 and back.
From LAN1 to LAN2 everything is OK. 
From Lan2 ip from LAN1 not visible.
NAT I did not 'up'. I can not understand what the problem. Thanks for your help


```
[b]uname -a[/b]
FreeBSD ### 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Thu Aug 12 18:12:56 EEST 2010     ##@###:/usr/src/sys/amd64/compile/###  amd64

[b]$ netstat -nr[/b]
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            10.0.10.1        UGS         0      944   bge1
10.0.10.0/24       link#1             U           2     6967   bge0
10.0.10.227        link#1             UHS         0        0    lo0
10.0.20.0/24       link#2             U          16   129101   bge1
10.0.20.227        link#2             UHS         0        0    lo0
127.0.0.1          link#5             UH          0       48    lo0

[b]$ cat /etc/rc.conf[/b]

#--------------------
defaultrouter="10.0.10.1"
gateway_enable="YES"
#pf_enable="YES"
hostname="cerberus"

#--- ifconfig -------
ifconfig_bge0="inet 10.0.10.227  netmask 255.255.255.0"
ifconfig_bge1="inet 10.0.20.227  netmask 255.255.255.0"

#--------------------
keymap="ua.koi8-u"
nfs_client_enable="YES"
sshd_enable="YES"



# -- disable INET6 -------------
#options        INET6                   # IPv6 communications protocols

# -- add ALTQ support  ----
options         ALTQ
options         ALTQ_CBQ
options         ALTQ_RED
options         ALTQ_RIO
options         ALTQ_HFSC
options         ALTQ_PRIQ
options         ALTQ_NOPCC

# -- add it/12.08.2010 -----------------
options         HZ=1000
options         DEVICE_POLLING

# -- PF Support ---------
device          pf
device          pflog
device          pfsync
device          if_bridge
```


----------



## SirDice (Aug 13, 2010)

You don't need NAT.

Assuming 10.0.20.0/24 is LAN2, make sure the clients on that subnet use 10.0.20.227 as their default gateway. Similarly, hosts on the LAN1 subnet need to use 10.0.10.227 as their gateway.


----------



## tsyselsky (Aug 13, 2010)

sorry scheme is not correct.
In LAN2 default gateway 10.0.10.1 (WAN) 
I added a route on 'WAN Router'
[cmd=]#route add-net 10.0.20.0/24 10.0.10.227[/cmd]
but the IP packets in X.20(LAN1) does not come


----------



## Savagedlight (Aug 14, 2010)

*BoxA*: the box which has contact with both LAN1 and LAN2
_*BoxB*_: the box on LAN2 which has access to the internet

LAN1's default gateway needs to be _BoxA_.
_BoxA_ will need to have _BoxB_ as default gateway.
_BoxB_ needs to have a routing entry telling that the IP range of LAN1 is to be routed via _BoxA_.

You also need to set up _BoxA_ as a router, so that it knows to route traffic between interfaces.

You should preferably set up a DHCP server on LAN2 (_BoxB_?) which pushes these routing tables to the clients, to avoid sending all the traffic (including traffic headed for LAN1) via _BoxB_.


----------



## tsyselsky (Aug 15, 2010)

Thanx guys. All work fine.


----------

