Into first port goes ethernet cable to main router and gateway on Pi device is set to same as main router. Now how can I get internet when connecting a device to the second port? When connecting a PC and try to use internet I get error '408 Request Time-out' in browser. With DNS setting to '8.8.8.8' I can google search but still can't open web pages. IPv4 Ping, IPv4 Traceroute and NSlookup all works when testing in Web UI. Is it a firewall setting I should change? I haven't changed anything of that from the factory setting.
OK I added a new interface named WAN with DHCP protocol to 'ethand then under Interfaces>>WAN>>Firewall Settings I added 'wan' to 'eth1' (tested also 'eth0'). Below added to the network config file:
config interface 'wan'
option proto 'dhcp'
option device 'eth1'
Is this what you meant? I feel I'm missing something and it doesn't seem to work. This is my firewall config btw:
config defaults
option syn_flood '1'
option input 'ACCEPT'
option output 'ACCEPT'
option fullcone '1'
option forward 'ACCEPT'
option flow_offloading '1'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option fullcone4 '1'
option fullcone6 '1'
option masq '1'
option mtu_fix '1'
list network 'wan6'
list network 'wan'
config forwarding
option src 'lan'
option dest 'wan'
The LAN side is set to static IP, I probably did wrong with the DHCP protocol on WAN, I've now changed to Static on WAN as well.
With another IP subnet you mean if IP is set to below on LAN:
OK thanks I thought it was the last digits that needed to be different. And IPv4 gateway (pointing to main router) should be the same on both LAN and WAN right or should I make a change there as well?
EDIGT: Should devices connected to port WAN also have 192.168.2 . subnet?
Pi should announce its lan ip as gw for the lan side devices.
They won't be able to talk to the lan side clients, but it depends on the upstream router.
If the main router uses ..2.x then clients connecting via it, but not going via the Pi, should use the same subnet.
Main router uses ..1.x. Do I have to configure anything on the main router? E.g if ..2.x needs to be added as IP subnet?
EDIT: Sorry didn't notice XXX.XXX.2.X '192.168.2.1' in first post was copied as the example shown here: How to configure two LAN ports - #4 by trendy. It should be XX.XX.1.XXX in my case.
I use the Pi for data storage. I could just remove the ethernet cable from the Pi and plug it into my PC but thought it must be done without having to go through that trouble. What are some other alternatives, could it be done without having the ports bridged in the first place? I did that before I knew I wanted to also have internet.
My main PC is connected to the main router. The PC in this example could also be a gaming console or some other device I need to hook up with internet.
This means setting up the Pi as a LAN device instead of a router. This serves the use case of dumb AP and various server applications.
To run as a LAN device, don't have a wan network. Set the lan static IP to something in the same subnet (here that would mean the first three numbers are the same) as the main router, but not exactly the same as anything else on the network. A safe choice is 192.168.1.254, since most main routers will not try to assign that IP by DHCP.
Also turn off the DHCP server which is on the LAN by default in OpenWrt. Set dhcpv4, dhcpv6, and ra all to disabled.
Maybe there is only one cable run to where the Pi and the PC are. In that case you can run the Pi as a two-port switch (bridge).
The new syntax where bridges are defined separately should be used.
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
list ports 'eth1'
config interface 'lan'
option device 'br-lan'
....
This is the software equivalent of an unmanaged Ethernet switch. Packets from the PC will be repeated directly to the main router without regard of the OpenWrt lan configuration.
Another thought on this is that if you've been upgrading OpenWrt for some time saving your original configuration all along, there may be other places where a deprecated configuration syntax is in use. It may be best to go back to defaults and reconfigure from scratch.
Yes thank you I just did. Now I've bridged the two ports once again (no WAN interface left) and given the Pi the same IP as main router (except last digits so that's unique on my network). IPv4 gateway has the same IP as main router and netmask is the same as I've got from the ISP 255.255.254.0. IPv4 broadcast is left blank.
Under Interfaces-Lan-DHCP Server I've checked the "Ignore Interface" under General Setup, that should be enough to disable dhcpv4, dhcpv6, and ra right? I still get "408 Request Time-out" when trying to access web pages.
EDIT: I figured out how to disable RA-service and DHCPv6-service but still "408 Request Time-out". I also tested disable NDP-Proxy (on the same page you disable the other two services above).