Getting to grips with /etc/config/network

I'm having a hard time getting to grips with /etc/config/network and could do with an explanation of some terms. There are mentions of eth0.1 eth0.2 lan wan switch vlan and lists of ports. I have one WAN port and four LAN ports. How can I tell which refers to what?
I would like all my ports to have IP addresses assigned by my DHCP server which would also be my Internet gateway. How do I configure my system so that all the LAN ports route via the WAN port?

Here's mine.

I only have 1 CPU eth, thus eth0.
There is 2 virtual LAN on my eth0. eth0.1 and eth0.2

VLAN1 is my eth0.1, all phsyical LAN ports are assigned to it.
VLAN2 is my eth0.2 and only my physical WAN port is assigned.

Hope it helps. Newbie here.

1 Like

Looks like you want to configure your device as a "dumb access point", there is a guide for that.

2 Likes

I did read the guide:-

TL;DR Here are the important configurations for a Wireless AP router (Dumb AP):

  1. The dumb AP is connected LAN-to-LAN to the main router through an Ethernet cable.
  2. The dumb AP bridges its wireless interface onto its LAN interface. Wireless traffic on the dumb AP goes to its (Ethernet) LAN interface, and then to the main router.
  3. The dumb AP LAN port has a static address on the same subnet as the main router's LAN interface
  4. The dumb AP's gateway is set to the address of the main router
  5. The dumb AP does not provide DHCP service, DNS resolution, or a firewall

I don't get point 3. Shouldn't the AP's WAN port be connected to the main router's LAN interface?

Thanks but I don't understand VLANs at all and wonder if I need to define them...

I'm still trying to find out what ports eth0 eth0.1 eth0.2 are physically assigned to.

AFAIK, dumb AP on that guide doesn't utilize WAN. So you have to connect your dumb AP's LAN to your main routers LAN.

Can you share a screenshot of your Switch configuration via LuCi->Network->Switch.

If I connect my main network to LAN2 on the router I can access the Internet. If I use WAN I can't.

Looking LuCi->Network->Switch

it shows where the cable from my network is connected, so if I insert it in WAN what else should I do? Enable VLAN functionality and tag all the ports and then save and apply?

Kindly attach the image of it here please.

You are mixing ethernet ports with VLANs. There is not a direct relation between one and the other (unless you configure it like that on the switch).

It looks like the image above:-

when I can access the Internet from my router. All I want to do is move LAN 2 to WAN

Emphasis added there. Routing means there are two separate networks at layer 2 (where switches work). So you should not change anything in the switch, as a lan->wan router is the default setup. If it doesn't work it is usually because the WAN IP range obtained from the upstream router or modem overlaps the LAN (it is also 192.168.1.X). In that case you need to change either the LAN IP or reconfigure the upstream device so it uses a different range.

If you do that (yes there are use cases where someone would want to do that, such as having an ISP-provided IPTV box which expects to be linked directly to the ISP modem/router), realize that the machine plugged into LAN2 will bypass OpenWrt entirely and be hardware switched to be part of the upstream router's network. To do this change LAN2 to be "off" in VLAN ID 1 (the lan network) and "untagged" in VLAN ID 2, the same as the WAN port is.

1 Like

Are you wanting to set up a different, seperated network for devices connected to your openwrt device? Or are you just trying to expand your existing network?

I'm just trying to add four extra LAN ports to my existing network.

So, if I understand your intent properly, you want to use the physical WAN port as an uplink to the upstream router, and then have all 4 physical LAN ports available for use on the network normally. If I have described this correctly, the solution is really simple:

Set the WAN port to 'off' in VLAN 2, and set it to 'untagged' in VLAN 1.

In the case of your device, all 5 physical ports are connected to a hardware switch chip inside the router. This means that ports can be easily reassigned as needed. By putting all 5 ports on the same VLAN, the device just operates more or less as an unmanaged (standard) switch with a single network across all ports.

Be sure to turn off the DHCP server on your OpenWrt router, and set the IP address to something in the same subnet as your main router (an address that is not part of the DHCP pool of the main router and is not used by any other devices on your network), or you can change the protocol on the lan from static to DHCP and have your main router assign an address.

2 Likes

Many thanks!! I can see the solution is really simple now, but I have always stayed away from VLANs.
I have things working more or less as I want, although I'd prefer to have an IP address assigned by my DHCP server, although I'm not sure if I will break something in the configuration.
At the moment I can ping everything on my network as well as 8.8.8.8, but I'm not sure where to set up a resolver. I don't see any option under
Network->DHCP and DNS->Resolv and Hosts Files
What am I missing?

You will need to look at your main router's DHCP reservation feature (assuming your main router is the DHCP server) -- you'll use the MAC address that shows up for your OpenWrt device and then tell your DHCP server to always assign a specific IP.

It shouldn't... but you'll need to make sure you know what IP address is assigned, of course. Your main router/DHCP server's leases (or the reservation you set) will obviously help you figure that out.

You only need to do this if your OpenWrt router has the lan interface configured as static... you'll see it in the lan interface configuration > Advanced Settings > Use Custom DNS servers

Meanwhile...

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.