My OpenWRT Routers initial configuration

2022-08-01 - ethernet and system
Tag: OpenWRT

Introduction

This article is the second one in a series about my home network:

If you try to follow this as a guide and something is not clear do not hesitate to shoot me an email asking for clarifications or screenshots!

Initial configuration

I will assume you just completed a clean installation of OpenWRT from the official documentation, in my case https://openwrt.org/toh/netgear/r6220. With that done, the first step is to plugin a RJ45 cable between your computer and one of the lan ports behind the router.

You should get an address in the 192.168.1.0/24 network through dhcp. With it you can access the webui and login as root by leaving the password field blank. Then go set an admin password from the system/Administration menu.

Interfaces

For my setup I first need to re-address the lan interface of OpenWRT since by default it uses the network subnet I want to use on my LAN. My LAN being what I will connect the wan interface of the OpenWRT router to. It can get confusing: just remember that the wan interface will be the exit point of the traffic going through the router, while lan ports are the one for devices the furthest from the internet.

In order to readdress the lan interface, I cannot be connected to it. Therefore our first step is to setup the wan interface and reconnect to the webui with it:

Now we can reconfigure the lan interface:

And finally reconfigure the wan interface:

I leave the INPUT traffic allowed on my firewall because I intend to access my router from my LAN, which means through this interface named wan

System configuration

It is a good time to set the hostname in the System/System menu, as well as your router’s timezone. On the Logging tab of this page, I also reconfigure the log output level to INFO and the cron log level to NORMAL. NTP should be active for time synchronization, and finally I like to set the webui theme to BootstrapDark.

Next, since the router should now have access to the internet through my FAI’s router, I head to the System/Software menu to add openssh-server. It is a requirement for me because the default ssh server is the one from busybox and it does not support ed25519 ssh keys, only rsa. I also install vim-fuller for ease of use but if the storage ever gets cramped I would remove it and not miss it.

I then set an ed25519 key through the System/Administration menu, in the SSH-Keys tab. It is then a good time to upgrade the packages which changed since the image’s release, which I do through ssh:

opkg update
opkg list-upgradable | cut -f 1 -d ' ' | xargs -r opkg upgrade

If critical components got upgraded (like busybox or openssl), it is a good idea to reboot the router.