<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tolulope Odueke</title>
    <description>The latest articles on DEV Community by Tolulope Odueke (@always_better_with_t).</description>
    <link>https://dev.to/always_better_with_t</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1174455%2F50010ab9-9ac1-4244-8a42-7cf48f0f23dd.jpeg</url>
      <title>DEV Community: Tolulope Odueke</title>
      <link>https://dev.to/always_better_with_t</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/always_better_with_t"/>
    <language>en</language>
    <item>
      <title>GameReady Router: How I Used A Raspberry Pi for Console &amp; Laptop LAN Connectivity</title>
      <dc:creator>Tolulope Odueke</dc:creator>
      <pubDate>Sun, 01 Oct 2023 23:13:08 +0000</pubDate>
      <link>https://dev.to/always_better_with_t/gameready-router-how-i-used-a-raspberry-pi-for-console-laptop-lan-connectivity-2a8l</link>
      <guid>https://dev.to/always_better_with_t/gameready-router-how-i-used-a-raspberry-pi-for-console-laptop-lan-connectivity-2a8l</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxct8pn4xn29lfm2dzxmk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxct8pn4xn29lfm2dzxmk.jpg" alt="DIY RPi LAN Router Title Card"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re like me, you’ve probably found yourself in a situation where you need a LAN connection—yes, even in 2023. Maybe you’re somewhere in a building with strong WiFi but no LAN outlets to connect your PlayStation 5 or your laptop. Doesn't that just suck?&lt;/p&gt;

&lt;p&gt;You see, when it comes to gaming or just browsing the internet in general, LAN doesn’t just beat WiFi, it annihilates it. It’s the silent guardian, the watchful protector of seamless gaming (and surfing the internet, duh!). Lower latency, fewer packet drops, and that steady stream of data, it’s like having a VIP pass in the chaotic festival of online gaming (and ... you get the point).&lt;/p&gt;

&lt;p&gt;Anyway, here’s how to turn your Raspberry Pi into a router that can act as a makeshift LAN outlet.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi connected to the internet via WiFi (I used a Raspberry Pi 3)&lt;/li&gt;
&lt;li&gt;A LAN cable&lt;/li&gt;
&lt;li&gt;An internet-capable device with a LAN connector (e.g., Laptop or Gaming Console; in my case, a PlayStation 5)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide assumes you’ve already installed an operating system (preferably a Linux distribution) on your Raspberry Pi and have internet access.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ℹ &lt;em&gt;Technical Information&lt;/em&gt;&lt;/p&gt;
&lt;h5&gt;
  
  
  Introduction to Core Concepts:
&lt;/h5&gt;

&lt;p&gt;Before diving into the steps to transform your Raspberry Pi into a router, it's essential to grasp some networking fundamentals:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;DHCP (Dynamic Host Configuration Protocol):&lt;/strong&gt; DHCP is a network protocol used to assign IP addresses dynamically to devices on a network. When a device connects to a network, DHCP allocates an available IP address, enabling the device to communicate with others on the same network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Static IP:&lt;/strong&gt; Unlike DHCP, which assigns IP addresses dynamically, a static IP is a fixed address assigned to a device. This consistent address ensures that other devices on the network can reliably communicate with it, which is crucial for servers or, in this case, your Raspberry Pi acting as a router.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT (Network Address Translation):&lt;/strong&gt; NAT is a method used to modify network address information in packet headers while in transit across a traffic routing device. It allows a single device, such as a router, to act as an agent between the public network and a local network, which enables a single unique IP address to represent an entire group of computers to anything outside their network.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 1: Connect Raspberry Pi to WiFi
&lt;/h3&gt;

&lt;p&gt;After booting your Raspberry Pi and accessing the Command Line Interface (CLI), run the following command to edit the &lt;code&gt;wpa_supplicant.conf&lt;/code&gt; file:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ℹ &lt;em&gt;Technical Information&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It would be a good idea to back up your wpa config file before carrying out the next few commands:&lt;/p&gt;


&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo cp&lt;/span&gt; /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.bak
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This would help if you ever need to revert the changes made to what you had previously.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/wpa_supplicant/wpa_supplicant.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the file, set your country= code. Then add your WiFi credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;network&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt;
    &lt;span class="nv"&gt;ssid&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Your WiFi SSID"&lt;/span&gt;
    &lt;span class="nv"&gt;psk&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Your WiFi Password"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update your package list and upgrade installed packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reboot your Raspberry Pi:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Set a Static IP Address for Your Ethernet Adapter
&lt;/h3&gt;

&lt;p&gt;To setup a gateway for the device that you want to connect to the Ethernet port, you will need to set a static IP address. This fixed address ensures that the devices connected to your makeshift router can consistently find it on the network, aiding in reliable communication. Without a static IP, the Raspberry Pi's address could change over time, disrupting the network setup and requiring reconfiguration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install dnsmasq for DHCP and DNS services&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;dnsmasq

&lt;span class="c"&gt;# Edit dhcpcd configuration&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/dhcpcd.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the bottom of the dhcpcd configuration file, paste the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# set eth0 (i.e the LAN port) to a static IP of 192.168.101.98, a gateway of 192.168.101.1 and uses a DNS server at 192.168.101.1&lt;/span&gt;
interface eth0
static &lt;span class="nv"&gt;ip_address&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.101.98/24
static &lt;span class="nv"&gt;routers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.101.1
static &lt;span class="nv"&gt;domain_name_servers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.101.1

&lt;span class="c"&gt;# set wlan0 (wireless) to a static IP of 192.168.101.99, a gateway of 192.168.101.1 and uses a DNS server at 192.168.101.1&lt;/span&gt;
interface wlan0
static &lt;span class="nv"&gt;ip_address&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.101.99/24
static &lt;span class="nv"&gt;routers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.101.1
static &lt;span class="nv"&gt;domain_name_servers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;192.168.101.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once this is done and saved, reboot the device again by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Update Network Interfaces
&lt;/h3&gt;

&lt;p&gt;Edit the network interfaces file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/network/interfaces
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;auto eth0

iface eth0 inet static
  address 192.168.5.1
  netmask 255.255.255.0
  network 192.168.5.0
  broadcast 192.168.5.255
allow-hotplug wlan0

iface wlan0 inet static
  address 192.168.101.99
  netmask 255.255.255.0
  gateway 192.168.101.1
  dns-nameservers 192.168.101.1
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;ℹ &lt;em&gt;Technical Information&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What we have done is make sure that eth0 starts automatically on boot (&lt;code&gt;auto eth0&lt;/code&gt;) and uses a static IP address of &lt;code&gt;192.168.5.1&lt;/code&gt;, a subnet mask of &lt;code&gt;255.255.255.0&lt;/code&gt;, a network address of &lt;code&gt;192.168.5.0&lt;/code&gt;, and a broadcast address of &lt;code&gt;192.168.5.255&lt;/code&gt;. We have also allowed &lt;code&gt;wlan0&lt;/code&gt; to be "hotplug-able" meaning that a device such as a WiFi dongle can be plugged into the raspberry without needing a reboot. It also assigns the Raspberry Pi a static IP address of &lt;code&gt;192.168.101.99&lt;/code&gt;, a subnet mask of &lt;code&gt;255.255.255.0&lt;/code&gt;, a default gateway of &lt;code&gt;192.168.101.1&lt;/code&gt;, and a DNS server at &lt;code&gt;192.168.101.1&lt;/code&gt;. It also uses WPA/WPA2 security settings from &lt;code&gt;/etc/wpa_supplicant/wpa_supplicant.conf&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now disable DHCP client services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;networking
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl disable dhcpcd

&lt;span class="c"&gt;# Edit dhcpcd config to ignore eth0 and wlan0&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/dhcpcd.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;denyinterfaces eth0
denyinterfaces wlan0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;ℹ &lt;em&gt;Technical Information&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;denyinterfaces eth0&lt;/code&gt;: This line tells the system not to manage the eth0 interface using DHCP or other automatic configuration methods. Essentially, eth0 will be ignored by the dhcpcd service or similar networking services.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;denyinterfaces wlan0&lt;/code&gt;: Similarly, this line prevents the wlan0 interface from being managed automatically.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Reboot again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify your settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ifconfig
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;ℹ &lt;em&gt;Technical Information&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You should see something similar to this after running the command&lt;/p&gt;


&lt;pre class="highlight shell"&gt;&lt;code&gt;eth0: &lt;span class="nv"&gt;flags&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;XXXX…
inet 192.168.5.1 netmask 255.255.255.0 broadcast 192.168.5.255

…… Other confuration stuff

wlan0: &lt;span class="nv"&gt;flags&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;XXXX… 
inet 192.168.101.99 netmask 255.255.255.0 broadcast 192.168.101.255
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 4: Set Up DHCP Server
&lt;/h3&gt;

&lt;p&gt;We installed dnsmasq earlier. Now stop the service, back up the existing configuration, and add our settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Stop the service&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop dnsmasq

&lt;span class="c"&gt;# Backup existing configuration&lt;/span&gt;
&lt;span class="nb"&gt;sudo mv&lt;/span&gt; /etc/dnsmasq.conf /etc/dnsmasq.conf.orig

&lt;span class="c"&gt;# Edit configuration&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/dnsmasq.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;interface&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;eth0
listen-address&lt;span class="o"&gt;=&lt;/span&gt;192.168.5.1
dhcp-range&lt;span class="o"&gt;=&lt;/span&gt;192.168.5.50,192.168.5.100,12h
&lt;span class="nv"&gt;server&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8.8.8.8
bind-interfaces
domain-needed
bogus-priv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;ℹ &lt;em&gt;Technical Information&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In summary, this is what those lines of code do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operates on eth0 interface.&lt;/li&gt;
&lt;li&gt;Listens on IP 192.168.5.1.&lt;/li&gt;
&lt;li&gt;Allocates IPs between 192.168.5.50 and 192.168.5.100 with a 12-hour lease.&lt;/li&gt;
&lt;li&gt;Uses Google’s DNS (8.8.8.8) for upstream queries.&lt;/li&gt;
&lt;li&gt;Binds only to eth0 and includes some security and efficiency settings (domain-needed, bogus-priv).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Restart the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start dnsmasq
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Configure Port Forwarding and Internet Sharing
&lt;/h3&gt;

&lt;p&gt;Edit the &lt;code&gt;sysctl.conf&lt;/code&gt; file to enable IP forwarding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/sysctl.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uncomment or add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;net.ipv4.ip_forward&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Configure NAT and port forwarding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add IP tables rules&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;iptables &lt;span class="nt"&gt;-t&lt;/span&gt; nat &lt;span class="nt"&gt;-A&lt;/span&gt; POSTROUTING &lt;span class="nt"&gt;-o&lt;/span&gt; wlan0 &lt;span class="nt"&gt;-j&lt;/span&gt; MASQUERADE  
&lt;span class="nb"&gt;sudo &lt;/span&gt;iptables &lt;span class="nt"&gt;-A&lt;/span&gt; FORWARD &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="nt"&gt;-o&lt;/span&gt; wlan0 &lt;span class="nt"&gt;-m&lt;/span&gt; state &lt;span class="nt"&gt;--state&lt;/span&gt; RELATED,ESTABLISHED &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT  
&lt;span class="nb"&gt;sudo &lt;/span&gt;iptables &lt;span class="nt"&gt;-A&lt;/span&gt; FORWARD &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="nt"&gt;-o&lt;/span&gt; wlan0 &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT

&lt;span class="c"&gt;# Save changes&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"iptables-save &amp;gt; /etc/iptables.ipv4.nat"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Persist these settings by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/rc.local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add above "exit 0" in the &lt;code&gt;rc.local&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;iptables-restore &amp;lt; /etc/iptables.ipv4.nat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, reboot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After rebooting, connect a LAN cable to the Raspberry Pi and the other end to the device needing internet access. You’ve successfully turned your Raspberry Pi into a router!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flh3kwjpd38jsirrii779.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flh3kwjpd38jsirrii779.JPG" alt="LAN Cable Connected to Raspberry. Pi"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's the result of all that work! My Playstation 5 console is connected to the internet via the LAN we setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbw78v2deiohocemwzsl8.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbw78v2deiohocemwzsl8.JPG" alt="Playstation 5 Network Screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope this article has been helpful as I had a use case that made me scour the internet for details on how to achieve this. So this is written not just for anyone else that might have this challenge but also as a documentation for myself in the event that I might need to do this again!&lt;/p&gt;

</description>
      <category>raspberrypi</category>
      <category>diy</category>
      <category>playstation</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
