Hi,
I searched on the internet but didn't found anything about this question.
How to use one port for LAN and WAN at the same time ? OpenWRT runs on my laptop with only one ethernet port, it's connected to a switch. On Debian I managed to do like this but on Openwrt I got stucked. I need something like eth0.1 for LAN and eth0.2 for WAN connection
Topic: LAN and WAN on one physical interface
The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.
You are talking about a 802.1Q (VLAN or virtual LAN) configuration, where multiple IP networks exist on the same physical wire (or physical port).
The most common way to accomplish this in OpenWRT is to use the 'swconfig' tool: https://wiki.openwrt.org/doc/techref/swconfig
After you have mapped out the switch chip on your router, you can write the configuration to the /etc/config/network, and it will be applied automatically when the network is started during boot: https://wiki.openwrt.org/doc/uci/network/switch
EDIT: Whoops, you're running it on laptop. That changes things a bit, since laptops might not have switch chips. Maybe a software-based VLAN using the 'ip' command and 'iproute2' package? I'm not sure if this package is available pre-built for OpenWRT, though.
(Last edited by Antek on 16 Aug 2017, 18:24)
How did you do it on debian?
It should work to set option ifname 'eth0.1' in the lan section of your /etc/config/network (and of course eth0.2 in wan). This will cause the port to emit 802.1Q tagged packets.
Thank you very much for your answers.
@Antek
There is no switch built into my X86 laptop, on router hardware it's no problem to cofigure the switch via luci interface but I never tried it with OpenWRT terminal. I thought VLAN on OpenWRT can only be used with a switch.
@rj-45
There was eth0 as LAN client and a "virtual" network with static IP on eth0.1, the machine was connected to an OpenWRT router with 5 1000Mbit/s ports, internal switch and mwan3. It was possible to use the one connector for routing port-based over the several uplinks at the OpenWRT router and to provide a network/gateway for other clients over LAN or WLAN.
@mk24
After a couple of hours I simply tried to configure the interfaces in /etc/config/network and it worked. Now there is WAN eth0 and an additional LAN eth0.100 and both are online. The next problem is the routing between the networks, I have to work for it tomorrow.
As mentioned, I had no problem with OpenWRT on my router hardware but on the laptop with only one port it's a little bit to much for me
The discussion might have continued from here.