1

I have a laptop running Debian 7 that connects to my building's Wifi. I want so share this network connection via the laptop's Ethernet port.

I have setup a script below to do this based on some Googling. It does forward the traffic fine to eth0, however it almost completely kills the networking performance on the laptop. I can only fully restore networking performance on the laptop by subsequently running "sudo sysctl -w net.ipv4.ip_forward=0".

Is there any way I can have this IP forwarding working but still retain good networking performance on the laptop?

#!/bin/bash

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s 172.16.0.38/16 -o wlan0 -j MASQUERADE
4
  • 3
    You could try just bridging the two interfaces together instead of NAT routing.
    – Celada
    Commented Nov 8, 2014 at 18:39
  • Sounds good, how do I do that?
    – Virgil
    Commented Nov 8, 2014 at 19:25
  • 2
    Plenty of HOWTOs out there, including this one specific to Debian showing you how to configure it in /etc/network/interfaces
    – Celada
    Commented Nov 8, 2014 at 19:27
  • Looks like their is some fundamental problem in trying to bridge a Wifi and Ethernet interface? I can't get past "can't add wlan0 to bridge br0: Operation not supported"
    – Virgil
    Commented Nov 8, 2014 at 21:04

1 Answer 1

-2

Fundamentally, your problem here is that the bandwidth on your downstream connection (eth0) is higher than the bandwidth on your upstream connection (wlan0).

To solve this, you need to throttle the speed on eth0 to something below the speeds of wlan0; I have used Wondershaper for this sort of thing.

3
  • 3
    This is incorrect. TCP/IP is very good at high speed links funelled into lower speed bottlenecks and vice versa. Most of the whole Internet is made up of interconnected links with mismatched speeds, usually with WANs being faster than LANs. Software traffic shaping actually does a poorer job of this than normal interface packet queues that naturally drain at the speed of the link they are sitting in front of.
    – Celada
    Commented Nov 8, 2014 at 19:40
  • 1
    @Celada Um, what? While the internal nodes will indeed balance their speed, what OP seems to be asking is to give priority to the local node, because TCP will not do that unless the local node has constant TCP traffic.
    – o11c
    Commented Nov 8, 2014 at 20:44
  • 1
    Thanks for the comments guys. I am not sure any explicit prioritization is needed, I just need to work out why the laptop which has the Wifi connection is slowed down about 50X when I have the forwarding enabled.
    – Virgil
    Commented Nov 10, 2014 at 16:30

You must log in to answer this question.

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