[How-To] Internet Source from WIFI To Ethernet [Bridge WiFi to Ethernet]


Recommended Posts

Hello im new and im Italian so i hope you will not hate me if i write not perfectly (Who said Google Translate?? No No No)

 

This Guide is for a "client to client" setup of the box, we will internally switch Wifi to Eth, so a working computer can access internet from its eth port even if the router signal source is wireless.

 

Router AP -----> ARM BOX [WIFI internal or usb dongle] ===>> internal eth0 ------> ethernet cable --> client eth port

 

  • Make sure WiFi in arm box is connected using nmtui command
    • FROM NOW ON <WIFI CARD> is the wifi adapter name es: replace "<WIFI CARD>" with "wlx0013eff301ee"
  • Execute: sudo apt-get update && sudo apt-get install dnsmasq iptables iptables-persistent -y
    • say no to save actual iptables rules (we dont have any yet)
  • Edit /etc/network/interfaces
    • comment if exist the part of eth0 "iface eth0" to "#iface eth0"
    • add those lines
    • allow-hotplug eth0
      	iface eth0 inet static
      		address 172.24.1.1
      		netmask 255.255.255.0
      		network 172.24.1.0
      		broadcast 172.24.1.255
      		dns-nameservers 1.1.1.1 1.0.0.1
      	#########{Static}###########
      	up ip addr add 172.24.0.1/24 dev eth0
  • execute those commands
    • REMEMBER TO REPLACE <WIFI CARD>
    • ip addr add 172.24.0.1/24 dev eth0
      iptables -A FORWARD -o <WIFI CARD> -i eth0 -s 172.24.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
      iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
      iptables -t nat -F POSTROUTING
      iptables -t nat -A POSTROUTING -o <WIFI CARD> -j MASQUERADE
      sh -c "iptables-save > /etc/iptables.ipv4.nat"
      sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
      /etc/init.d/dnsmasq stop
      cp /etc/dnsmasq.conf /etc/dnsmasq.conf-backup
  • Edit /etc/dnsmasq.conf inserting
    • interface=eth0
      listen-address=172.24.1.1
      bind-interfaces
      server=1.1.1.1 
      domain-needed
      bogus-priv
      dhcp-range=172.24.0.100,172.24.0.250,72h
  • Edit /etc/sysctl.conf inserting
    • net.ipv4.conf.default.forwarding=1
      net.ipv4.conf.all.forwarding=1
  • Edit /etc/rc.local inserting before "exit 0"
    • iptables-restore < /etc/iptables.ipv4.nat
  • execute those commands
    • systemctl enable dnsmasq
      systemctl enable iptables

 

 

Explainations:

 

We set static net to eht0 then we set routing in iptables [forward and back] wlan<->eth then we make this setup persistent so that will persist after reboot.

Working on my RK3318 Armbian bullseye 5.15 minimal and USB3 dongle RTL8814AU (also tested with a 8812au)

Edited by MR01
Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

1 1