What's a simplistic recipe to connect my PC to my WLAN through my laptop?

I have one wireless network, one desktop that (for practical reasons) has no connection to the WLAN, and one laptop with wireless and an ethernet port.

I would like to run a cable from my desktop to my laptop, connect my laptop to my WLAN and forward the network to my desktop.

Is there a solution?

  • What unix variant does your laptop run? The commands will be different on different variants. If it's Linux, specify your distribution: there may be a distribution-specific way that's a lot simpler than the simplest distribution-agnostic way. Sep 6, 2010 at 21:52
  • I am running archlinux, but I think more people could benefit from a "distribution-agnostic" answer...
    – Stefan
    Sep 6, 2010 at 22:09

4 Answers 4


Simple and platform agnostic:

  1. Ensure that the two networks to be bridged have different subnet addresses.
  2. Enable standard Linux IP forwarding in /etc/sysctl.conf.

For different subnets, assuming you are using the allocated private class C space, 192.168.1.* and 192.168.2.* are different subnets.


Asuming that:

  • PC1 has a working internet connection which we want to share with PC2.
  • PC1 is connected to PC2 with a cross-over cable or a switch
  • is the IP address we assign to PC1
  • is the IP address we assign to PC2
  • is the IP address for the nameserver used by PC1 ( cat /etc/resolve.conf on PC1 )


eth0 is the network interface that connects to PC2

# configure eth0
ifconfig eth0 netmask
ifconfig eth0 up

# enable forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

# forward with iptables
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/etc/rc.d/iptables save
/etc/rc.d/iptables start


eth0 is the interface that connects to PC1

# enable eth0
ifconfig eth0 netmask
ifconfig eth0 up

# route through other pc
route add default gw

# specify nameserver
echo "nameserver" >> /etc/resolve.conf

See Internet Share for reference.

  • 1
    on PC2, shouldn't the gateway be set to and there is a confusion in the 1st part (both addresses are assigned to PC1) Aug 15, 2011 at 8:28
  • bash: /etc/rc.d/iptables: No such file or directory
    – tsbertalan
    Oct 20, 2017 at 20:24
  • Thanks. Why is the nameserver on PC2 set to be the same as that on PC1?
    – Tim
    Dec 5, 2023 at 16:36

You can also connect the laptop to the WLAN, the desktop to Laptop and only bridge the connections on the laptop so you don't need to run anything on the laptop (DHCP/NAT). The Desktop will get its config from the WLAN dhcp.

  • That's just not working like this with Wifi. Wifi is not Ethernet. It requires 4 MAC addresses for this but only 3 are used by default. See: networkengineering.stackexchange.com/questions/25100/… for some details. Requires support from AP (eg: a reconfigurable hostapd) and laptop.
    – A.B
    Jun 2, 2023 at 16:39

Ok, I don't think I really have the answer here but here it goes:

  1. Connect your laptop to the WLAN,
  2. Connect your Desktop to your Laptop (make sure to configure the IP's properly, or have a DHCP server on your laptop),
  3. Use firestarter (should be available on your package manager) to create a bridge between the two connections.

That's as far as I could get by researching the subject; hope this info serves as a good starting point.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .