-2

Is it possible to convert old laptop with OpenWRT OS on it and 2 NIC as a routers alternative? and how that must be done?

15
  • 2
    OpenWRT is typically only compiled against ARM devices. You would have to compile OpenWRT against x86 that includes providing the proper device drivers.
    – Ramhound
    Commented Aug 9, 2021 at 21:55
  • copy that, but I want to convert PC as a router instead of buying cisco routers for small network, and how can I do it ? Commented Aug 9, 2021 at 22:02
  • 1
    You would need to update, resolve all code conflicts, and build OpenWRT so it can successfully run on x86 hardware. You would need to have a vast knowledge of the WiFi device in your machine. You most likely would need to write your own Linux kernel drives since the only one that's that are compatible with OpenWRT are targeted towards ARM hardware.
    – Ramhound
    Commented Aug 9, 2021 at 22:03
  • Okay that's clear, but can u give me more description how to set it up? I never did that and want to do so. Commented Aug 9, 2021 at 22:11
  • Until you recompile OpenWRT to work on x86 hardware there is no way to setup OpenWRT on your laptop. There are better solution that exists for x86 hardware than OpenWRT. Honestly, unless you have a working build, there isn't much to provide. How you go about building OpenWRT to work with x86 is a very complicated process, a process that is not impossible, but certainly very difficult for one single person.
    – Ramhound
    Commented Aug 9, 2021 at 22:12

1 Answer 1

0

how to set two NIC at the same time?

See end of the answer for the script I use on my old desktop with Devuan (Debian variant without systemd) to temporarily NAT my LAN (eth0) to my home router on the WLAN (wlan0). This will work with any NICs.

It includes firewall rules so only connections initiated from the LAN will pass. You need additional rules for port forwarding.

I have also configured a DHCP server on eth0. In your case

for local small network (near 50 endpoints)

I'd use dnsmasq as a lightweight one-stop implementation of DNS proxy with caching, DNS for the LAN, and DHCP. (That's also what many routers use, BTW).

And google a bit for more information, there must a hundred tutorials on how to set up NAT on Linux (I learned this from one of the decades ago). I also posted this script at least three times on stackoverflow.

Script:

#!/bin/bash                                                                                                                                                                                  

# masquerade $1 (e.g. eth0, ppp0) as $2 (default wlan0)                                                                                                                                      

INTIF="$1"
EXTIF=${2:-wlan0}

echo $INTIF $EXTIF

echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -t nat -F
iptables -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

This script clears the firewall when run, something you may or may not want.

There are various ways to make this setup "permanent" (restored on boot). Details depend on the distro you use.

1
  • thanks for your answer Commented Oct 12, 2021 at 12:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .