How To: Share Your Laptop's Wireless Internet with Ethernet Devices

Share Your Laptop's Wireless Internet with Ethernet Devices

Sharing a laptop's wireless Internet connection with other computers connected to its Ethernet port is a great skill to know. It can be good for a number of reasons; Your computer may not have proper hardware to have a standard setup, or you may have an awkward network topology where sharing your wireless Internet via Ethernet would just be a better option.

Windows make it pretty easy for you. Just right-click the network profile and hit "share".

If you have Linux or Mac, it's a bit more difficult. These systems use IPtables to configure how they control ports, masquerading, port forwarding, and all things of that nature. This Null Byte is for you home users who need to share your wireless Internet to gaming consoles like the Xbox 360, or to network admins who aren't very familiar with Linux servers.

Step 1 Download IPtables

We are going to start by downloading the iptables package. I'm using Arch Linux. Ubuntu users will need to use apt-get install instead of pacman -S. Mac users already have it pre-installed, so you can skip this step. Things in bold are the terminal commands you should enter.

Download IPtables:

    sudo pacman -S iptables

Step 2 Configure IPtables

Now we need to set our IPtables up to forward the Ethernet traffic to your wireless interface.

Bring your Ethernet interface up:

    sudo ifconfig eth0 up

Now, assign a static IP to the Ethernet interface:

    sudo ifconfig eth0

Now, enable IP forwarding from your Ethernet interface. This will allow it to be shared.

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

This last command will forward everything within the 192.168.2.* IP range.

    sudo iptables -t nat -A POSTROUTING -o wlan0 -s -j MASQUERADE

When that's all set, I reccommend you throw all of the commands in a script at the end of your /etc/rc.conf file. Here is what mine looks like:

How to Share Your Laptop's Wireless Internet with Ethernet Devices

(Note: You don't have to use the 192.168.2.* range… I just use it for these tutorials to avoid device conflicts. Change the 2 to a 1 if you want to keep things normal.)

Step 3 Configure the Ethernet Device

I'm going to be using an Xbox 360 as an example for my Internet sharing. The same rules will apply across any device.

Here are the settings I used:

  1. Static IP:
  2. Gateway:
  3. DNS:

If your device doesn't receive Internet, try rebooting with the Ethernet cable left in.

That's all you need to remember when configuring devices to use your laptop's wireless Interface via Ethernet. That's also how to get a free wireless adapter on older Xbox 360s! Null Byte kills two birds with one stone!

Come hang out on IRC and follow me on Twitter!

Just updated your iPhone? You'll find new features for Podcasts, News, Books, and TV, as well as important security improvements and fresh wallpapers. Find out what's new and changed on your iPhone with the iOS 17.5 update.

Photo by William Hook

1 Comment

How about the code to deactivate this process if needed?

Share Your Thoughts

  • Hot
  • Latest