Wireless to Ethernet
The purpose of this setup is to share a wireless internet connection over an Ethernet connection, enabling other devices to access the internet via the Ethernet network created on Mecha Comet.
Prerequisites
- Ensure you have
nmcli
andnftables
installed on Mecha Comet. - Replace
wlan0
andend0
with your actual Wireless interface and outbound network interface names. - Ensure Mecha Comet is connected to wireless and have internet access.
Steps
1
Connect Mecha Comet to a Device with an Ethernet Port
Physically connect the Mecha Comet to another device (e.g., a laptop / desktop / mecha comet) using an Ethernet cable. Ensure the Ethernet port is functional on both devices.
2
Check Existing Network Connections
$ nmcli connection show
Identify the name of the Ethernet connection you want to modify (e.g., Wired connection 1
).
3
Configure IPv4 Method to Shared
$ sudo nmcli connection modify "<connection-name>" ipv4.method shared
4
Bring Up the Ethernet Connection
$ sudo nmcli connection up "<connection-name>"
5
Configure NAT with nftables
Create a NAT Table
$ sudo nft add table ip nat"
Add a NAT Chain
$ sudo nft add chain ip nat POSTROUTING { type nat hook postrouting priority 100 \; }
Add a Masquerade Rule for outgoing traffic through Wireless
$ sudo nft add rule ip nat POSTROUTING oif "wlan0" masquerade
Verification
Verify the Ethernet connection status:
nmcli device status
Check the NAT table rules to confirm the configuration:
sudo nft list table ip nat
Notes
- Ensure your Ethernet adapter is functional and properly connected.
- Replace interface names as needed for your specific setup.
Troubleshooting
- If the Ethernet connection fails to start, ensure the cable is securely connected.
- Verify that
nftables
is enabled and properly configured.