How to share wifi network as ethernet network in antiX 26 sysvinit

Inspired and modified from: https://siberoloji.com/how-to-share-an-internet-connection-via-ethernet-in-debian-12/

1: Identify Network Interfaces

The first step is to identify your network interfaces. Open a terminal and run:

ip a

1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 00:23:8b:ef:ca:6a brd ff:ff:ff:ff:ff:ff
3: wlan0: mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:25:56:71:8e:93 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.178/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
valid_lft 6919sec preferred_lft 6919sec

***************************
2: Enable IP Forwarding

sudo nano /etc/sysctl.conf

… add

net.ipv4.ip_forward=1

… save and quit

Ctrl o
Ctrl x

sudo sysctl -p

***************************
3: Configure Network Address Translation (NAT) with iptables

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i eth1 -o wlan0 -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

To make these rules persistent across reboots, install the iptables-persistent package:

sudo apt install iptables-persistent

During installation, you will be prompted to save the current rules. If not, save them manually with:

sudo netfilter-persistent save

***************************

4: Assign a Static IP Address to the Ethernet Interface

sudo apt install ifupdown
sudo nano /etc/network/interfaces

Add the following lines:

###source /etc/network/interfaces.d/*

auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

***************************
5: Remove SSH and set Up a DHCP Server

sudo apt purge ssh*

sudo apt install isc-dhcp-server

Edit the DHCP configuration file:

sudo nano /etc/dhcp/dhcpd.conf

Add the following configuration at the end:

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
}

Edit the default interface configuration file:

sudo nano /etc/default/isc-dhcp-server

Find the line:

INTERFACESv4=””

Modify it to specify the Ethernet interface:

INTERFACESv4=”eth0″

***************************
6. Start services

sudo service networking restart

sudo service isc-dhcp-server start

… or via /etc/rc.local file

service networking restart
service isc-dhcp-server start

***************************

DIAGNOSING:

When eth0 is up and running, ip a tells

eth0: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether f0:76:1c:86:1a:6f brd ff:ff:ff:ff:ff:ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global eth0

… and

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 600 0 0 wlan0
0.0.0.0 192.168.1.1 0.0.0.0 UG 1002 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 3003 0 0 wlan0
0.0.0.0 0.0.0.0 0.0.0.0 U -2049 0 0 eth0
xxxxxxxxxxx 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 600 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 3003 0 0 wlan0
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 1002 0 0 eth0

xxxxxxxxxxx=real IP address

***************************

TROUBLESHOOTING:

If networking restart gives an error, clear ip address and restart networking.

sudo ip addr flush dev eth0
sudo service networking restart

PS: When ethernet is working, the light is blinking in the ethernet cable.