OpenWrt as second Router on RPi

I am 1 day old to OpenWRT, currently using IPFire though want to try OpenWRT. Need some help here in setting up or some document.

I am trying to setup a home network. I am going to use OpenWRT device as second router / firewall after my ISP's device. So I will have this as gateway between lan1 and lan2.

NetworkSetup1. Internet <--wan1--> ISP Device(main router with dhcp) <-- lan1--> My Laptop [LanIp for this is 10.xx.xx.x]
NetworkSetup2. Internet <--> ISP Device <--wan2_OR_lan1--> RPi with OpenWrt <--lan2--> My Desktop [LanIp for this is 192.168.x.x]

I have installed OpenWRT on RPi, though RPi is not able get an IP from main router, it's always in Pending state. It works if I set RPi OpenWrt network.lan.ipaddr in range of 10.xx.xx.xx. But to me that's wan setting for RPi. Let me accept I am little confused here as I couldn't see any default wan setting in OpenWrt.

is this normal setup I am trying to achieve? any pin point documentation would be really helpful.

Haven't worked with RPi and OpenwRT, but are you sure the port is set to DHCP client, and not static ?

1 Like

So I figured it out. Updating steps here for future myself:

step1 (get internet connectivity)

step1.1 --> ifconfig # get WAN interface name. in my case this was eth0
step1.2 --> # update /etc/config/network as below

....loopback entry....
config interface 'wan'
^^indentation^^option ifname 'eth0'
^^indentation^^option proto 'dhcp'

step1.3 --> reboot
step1.4 --> ping # it should work before proceeding further

step2 (setup LAN interface )

step2.1 --> ifconfig # get LAN interface name. in my case this not appearing. I was using USB <--> Ethernet adapter
step2.2 --> # if step2.1 is not success do this:
opkg update && opkg install usbutils
step2.3 --> ifconfig # get LAN interface name. in my case this was eth1
step2.4 --> # update /etc/config/network as below

....loopback entry....
....wan entry....
config interface 'lan'
^^indentation^^option proto 'static'
^^indentation^^option ifname 'eth1'
^^indentation^^option ipaddr '' # this RPi address. It will be this LAN gateway
^^indentation^^option netmask ''
^^indentation^^option gateway '' # WAN gateway for this RPi
^^indentation^^option type 'bridge'

step2.5 --> reboot #after reboot LAN should also have internet access


RPi has only one ethernet port, which by default is assigned to lan interface, static IP and dhcp server running.
You can connect a usb2eth adapter to get another interface and assign it to wan interface, or you can use a managed switch and vlans to get more than one interface out of the same port.
Default image doesn't contain usb2eth modules, so you'll need to connect the RPi on the network, change the IP, add a gateway and dns, turn off the dhcp, update the packages, and install the missing modules.
Or you can flash wulfy23's image which contains already the usb modules, as well as other useful things.


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