OpenWrt Forum Archive

Topic: forwarding between 2 lan

The content of this topic has been archived on 7 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hi all,
I have a WRT54GL and I would like to use it for link 2 LAN

The first one is a 192.168.1.x and the second one is a 10.10.10.x
I would use 2 switch port for the first and 2 for the second.
Follows the configuration

   WRT54G #1
(lan 192.168.1.1) 
(lan2 10.10.10.1)
     /                   \                           
    /                     \                         
PC IN LAN     PC IN LAN
(192.168.1.4)   (10.10.10.4)


/etc/config/network

#### LAN configuration

config interface lan
        option type     bridge
        option ifname   "eth0.0"
        option proto    static
        option ipaddr   192.168.1.1
        option netmask  255.255.255.0
        option gateway  192.168.1.1
        option dns      151.99.125.1


config interface lan2
        option ifname    "eth0.2"

        option proto    static
        option ipaddr    10.10.10.1
        option netmask    255.255.255.0

config route
        option interface lan
        option target 10.10.10.0
        option gateway 10.10.10.1

config route
        option interface lan2
        option target 192.168.1.0

        option gateway 192.168.1.1




/etc/config/firewall

config 'defaults'
    option 'syn_flood' '1'
    option 'input' 'DROP'
    option 'output' 'ACCEPT'
    option 'forward' 'DROP'

config 'zone'
    option 'name' 'lan'
    option 'input' 'ACCEPT'
    option 'output' 'ACCEPT'
    option 'forward' 'ACCEPT'

config 'zone'
    option 'name' 'lan2'
    option 'input' 'ACCEPT'
    option 'output' 'ACCEPT'
    option 'forward' 'ACCEPT'

config 'forwarding'         
    option 'src' 'lan2'
    option 'dest' 'lan'

config 'forwarding'         
    option 'src' 'lan'
    option 'dest' 'lan2'


/etc/firewall.user
(ho aggiunto in fondo)
iptables -A forwarding_rule -i eth0.2 -o br-lan  -j ACCEPT
iptables -A forwarding_rule -i br-lan -o eth0.2  -j ACCEPT

The WRT54GL ping all the PC, but the PCs don't ping each one!

Can you help me!?

Is IP forwarding enabled?

echo 1>/proc/sys/net/ipv4/ip_forward

As long as this is set, all you have to do is ensure that computers from each LAN can talk to computers on the other.

I had a similar dilemma with routing between a wired and a wireless network (and I couldn't bridge because 802.11 doesn't allow bridging)... I was able to set a static route on the wireless router to the wireless-to-wired (w2w) router and then that was all I needed to do - with the wireless router as the default gateway, clients on the wireless router could easily find clients on the w2w router.

As long as each PC is set to use the router as its gateway (i.e. 192.168.1.4 has 192.168.1.1 as its default gateway), you should be able to talk between them without any firewall rules.

IP forwarding is enabled.

root@Ap1:~# cat /proc/sys/net/ipv4/ip_forward
1

this are the configurations


br-lan    Link encap:Ethernet  HWaddr 00:23:69:29:FD:A0
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:966 errors:0 dropped:0 overruns:0 frame:0
          TX packets:242 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:65424 (63.8 KiB)  TX bytes:31318 (30.5 KiB)

eth0      Link encap:Ethernet  HWaddr 00:23:69:29:FD:A0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1068 errors:0 dropped:0 overruns:0 frame:0
          TX packets:507 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:99048 (96.7 KiB)  TX bytes:91832 (89.6 KiB)
          Interrupt:4

eth0.0    Link encap:Ethernet  HWaddr 00:23:69:29:FD:A0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:966 errors:0 dropped:0 overruns:0 frame:0
          TX packets:242 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:69288 (67.6 KiB)  TX bytes:32286 (31.5 KiB)

eth0.1    Link encap:Ethernet  HWaddr 00:23:69:29:FD:A0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:47158 (46.0 KiB)

eth0.2    Link encap:Ethernet  HWaddr 00:23:69:29:FD:A0
          inet addr:10.10.10.1  Bcast:10.10.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:104 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:10718 (10.4 KiB)  TX bytes:9618 (9.3 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:47 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5012 (4.8 KiB)  TX bytes:5012 (4.8 KiB)

wl0       Link encap:Ethernet  HWaddr 00:23:69:29:FD:A2
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:64
          TX packets:698 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:56419 (55.0 KiB)
          Interrupt:2 Base address:0x5000



I need to static route? This are the routes


root@Ap1:~# route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan
10.10.10.0      *               255.255.255.0   U     0      0        0 eth0.2
default         192.168.1.1     0.0.0.0         UG    0      0        0 br-lan

Why the routing doesn't work?

The discussion might have continued from here.