0

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
  • 2
    You could try just bridging the two interfaces together instead of NAT routing. – Celada Nov 8 '14 at 18:39
  • Sounds good, how do I do that? – Virgil Nov 8 '14 at 19:25
  • 1
    Plenty of HOWTOs out there, including this one specific to Debian showing you how to configure it in /etc/network/interfaces – Celada Nov 8 '14 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 Nov 8 '14 at 21:04
-1

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.

  • 1
    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 Nov 8 '14 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 Nov 8 '14 at 20:44
  • 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 Nov 10 '14 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.