Different subnet on 2nd LAN port

i have a x86_64 device that has 3 ethernet ports.
-WAN pppoe
-LAN 192.168.0.0/24
-Spare

I would like to add a 2nd subnet into eth2 (192.168.1.0/24). Could you help me add it please?

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.0.1'

config interface 'wan'
        option device 'eth2'
        option proto 'dhcp'

config interface 'WAN_pppoe'
        option proto 'pppoe'
        option device 'eth0'
        option username 'atux@isp.com'
        option password 'null'
        option ipv6 '0'

config interface 'Modem_check'
        option proto 'static'
        option ipaddr '192.168.178.27'
        option netmask '255.255.255.0'
        option device 'eth0'

Remove the "wan" interface, then repeat and adapt the config for the "lan" interface.

2 Likes

thanks for the reply. Does it have to be in the bridge or not?
what about the firewall rules?
...........................
i configured it as the following

config interface 'Subnet_2_client'
        option device 'eth2'
        option proto 'dhcp'

but i do not have Internet access!

If you're assigning the network to exactly one physical interface, it does not need a bridge.

This won't work unless it is connecting to a network that already has a DHCP server.

Instead, it should look like this:

config interface 'subnet2'
        option device 'eth2'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.1.1'

You'll also want to add a dhcp server (in most cases) for the new subnet...

config dhcp 'subnet2'
	option interface 'subnet2'
	option start '100'
	option limit '150'
	option leasetime '12h'
	option dhcpv4 'server'

And, at least for simplicity for the initial tests, you'll want to add this new subnet2 network to the lan firewall zone.

there is already a dhcp server on the end that i am connecting the eth2. But still i am not getting Internet access in the router, nor i can access the subnet in eth2. Here is the config of eth2:


what am i doing wrong?

Is this new subnet a second connection to the internet? If so, you need to use policy based routing or mwan3.

Can you provide a basic topology diagram so that we can understand how these networks work?

i am not looking for Internet on eth2. I do not have Internet in general from any interface.
So, my router has 3 interfaces:
[] eth0 pppoe to the ISP
[
] eth1 LAN
[*] eth2 LAN2

I am looking to access to LAN2, not internet from there. LAN2 has dhcp server on their side, but i am using a static IP in eth2.

when i configure eth2 as the aforementioned config (attached printscreens in my previous post), the router does not have Internet.

Remove the default gateway from the interface settings.
No RX/TX after 5 seconds uptime doesn't seem normal.

Seems to ping the network in eth2, from OpenWRT, but not from the PC.

$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=1.664 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=0.948 ms
^C
--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.948/1.306/1.664 ms

and from the PC:

ping 192.168.1.1

Pinging 192.168.1.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

nor access from the internet (portforward)

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'Subnet_1_ssh'
        option src 'wan'
        option dest_ip '192.168.1.1'
        option dest_port '22'
        option src_dport '55522'

What network is the PC on - 192.168.0.0/24?

You need a static route on 192.168.1.1:

ip route add 192.168.0.0/24 via 192.168.1.250

I am not familiar with your network topology, but if 192.168.1.1 has its own default gateway this will not work.

i would like all the devices from network 192.168.0.0/24 to access the 192.168.1.0/24.
this is an attached network to Openwrt and it is know. It is a matter of firewall. How do i fix that, please?

Regarding the portforward, i am looking to get ssh access via OpenWRT's connection to the LAN IP address of the new subnet.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.