Using OpenWrt as web-server

I installed openWRT x86 on my netbook to create a web server on nginx, but I cannot connect it to the Internet, I connect it with my ethernet cable to my router, but opkg cannot download packages, wget also does not work. ping measures only 192.168.1.1, 127.0.0.1 and 0.0.0.0, it does not see other devices on my local network. What should I do to make everything work fine? and how can i turn off the openWRT internal local network? (I will be for any clarification in this matter)

:thinking: not an expert here

But does your netbook has an Ethernet interface with two rj45 plug ? Or you plan to use Ethernet card to connect to WAN and the WiFi card to provide Lan interface ? In case you plan to use only Ethernet for both WAN and LAN (if it is feasible) I believe the router should be one that supports that setting too. Please everybody let me know if what I think is meaningful or not?

Okey think I got it ! You just need one interface being wan or lan will determine how to setup your web server configuration

PS

Welcome to the community

@zazolin9999, welcome to the community!

If you only have 1 Network Interface in the x86, then it was configured as LAN - NOT WAN.

I am not a master in network connections, and the main problem is that when I used the ubuntu-server, I could connect my cable to my router, go online and interact with other devices on the router’s local network, but everything is different in openWRT : I can not access the Internet and communicate with other devices on the local network. openWRT sees only 3 ip addresses of its own local network and does not want to take into account the ip addresses from the Internet and the router’s local network. therefore, the openWRT own local network is most likely to blame, in that case, how to turn it off?

and how to set it up?

Devices with a single ethernet port are configured as LAN, with dnsmasq and odhcpd started (both of which probably shouldn't be in your use case), make sure to use either dhcp for requesting the IP settings on your LAN interface or configure a static IP with default gateway and a correct DNS server IP.

In general I wouldn't suggest to use OpenWrt for this purpose, even less if exposed to the open internet or potentially untrusted internal parties, general purpose distros can be updated at runtime, which is crucial for security sensitive components (and your netbook shouldn't have the slightest issue with running e.g. Debian, Fedora, OpenSuSE, arch, gentoo, Ubuntu, Megeia, etc. pp.).

3 Likes

But like @slh, I advise using a full distro for this use case.

1 Like

https://openwrt.org/docs/guide-user/base-system/basic-networking

https://openwrt.org/docs/guide-user/network/ucicheatsheet

Here the manual (kind of) pages about network configuration on openwrt devices

File that stores network config is

/etc/config/network

I added a 'wan' block with ethernet port 'eth0' to the configuration file 'network', now openwrt connects to my router and has access to the Internet, but cannot communicate with other devices on the router's local network - what am I doing wrong?

  • I have no clue what a "WAN block" is, and no clue why you would add it to "network"
  • You tell us!

Perhaps you should show these configs?

the fact is that I need a very light, fast and simple linux server distribution for my projects, I need it to work in Life-USB mode without problems, the same ubuntu-server will be difficult to install on a USB flash drive, and because of the size (900M disk image, if I'm not mistaken), it will take a long time to load. so openWRT is the best I've found so far.

I run FreeBSD and Debian off USB sticks all the time on AMD64 / x86_64. Install a “server” selection (no GUI) and it starts up very quickly. SPI NOR flash isn’t fast.

1 Like

=8 GB USB sticks have become really cheap these days, even USB 3 sticks (which should be strongly preferred). At least the later provide pretty reasonable performance (don't compare cheap USB sticks from the days of yore with the performance of semi-decent USB 3 sticks (~5 EUR for 8 GB USB3); it's better to sacrifice a bit on size, than throughput though).

...there are still dog slow USB3 memory sticks around like the Sandisk Cruzer series for instance or Kingston's DT100 series.

Is Puppy Linux still alive?

image

Their logo is awesome !!

https://drive.google.com/file/d/1bB82BCBbElPwPPDbtT9yn9FGRdkkuelR/view?usp=drivesdk. I just added the 'wan' interface configuration, assigned it to a single ethernet connector, and turned on dhcp, the server got access to the Internet, but other devices on the router’s local network do not see the server, which is important to me

What is the output of the following commands?
cat /etc/config/network; cat /etc/config/firewall; cat /etc/config/wireless ; cat /etc/config/dhcp ; ip -4 addr ; ip -4 ro ; ip -4 ru

@zazolin9999 Your /etc/config/network at config interface 'lan' has an option proto 'static' and option ipaddr '192.168.1.1, but what is your routers IP? If you have an OpenWRT router with default IP, you probably have the same (192.168.1.1) IP for 2 devices, so other devices can't see your netbook with the same IP as your router. Just a thought...
Another think is that my /etc/config/network has 60 lines, not 21. Is 21 normal for all functions?

You should remove the ethernet port from the LAN bridge and then create a network with that port with DHCP client and the firewall in WAN.