4 replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
source | link
3 deleted 2 characters in body
source | link
  1. Enable IPv4 Forwarding, so your Pi acts as a router by forwarding any traffic it receives
  2. Configure your Pi with static network configuration so it will not be influenced by DHCP changes suggested below. Here are the contents of my /etc/network/interfaces as reference:

    # pi@flux:/home/pi/projects/adsl/rrdlogger (master *)
    # cat /etc/network/interfaces 
    auto lo
    
    iface lo inet loopback
    #iface eth0 inet dhcp
    iface eth0 inet static
            address 192.168.1.1
            netemask 255.255.255.0
            gateway 192.168.1.254    # IP of my ADSL router box
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    
  3. Now change your network's DHCP settings such that the default gateway  / routerrouter is your Pi. This likely means changing the settings on your existing ADSL router box. In my example above, my Pi's IP address is 192.168.1.1.

Update:: You also need to disable the transmission of ICMP redirects, since we need all traffic to go through the Pi for shaping to happen. It turns out that the Linux kernel is smart enough to figure out that the clients on your home network could talk directly to the ADSL box, rather than bounce traffic through the Pi, and it tells them this at every opportunity. The clients then send their traffic directly to your ADSL box, and the Pi doesn't get a chance to shape it. Disable it on the fly like so (lost when you next reboot):

  1. Enable IPv4 Forwarding, so your Pi acts as a router by forwarding any traffic it receives
  2. Configure your Pi with static network configuration so it will not be influenced by DHCP changes suggested below. Here are the contents of my /etc/network/interfaces as reference:

    # pi@flux:/home/pi/projects/adsl/rrdlogger (master *)
    # cat /etc/network/interfaces 
    auto lo
    
    iface lo inet loopback
    #iface eth0 inet dhcp
    iface eth0 inet static
            address 192.168.1.1
            netemask 255.255.255.0
            gateway 192.168.1.254    # IP of my ADSL router box
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    
  3. Now change your network's DHCP settings such that the default gateway  / router is your Pi. This likely means changing the settings on your existing ADSL router box. In my example above, my Pi's IP address is 192.168.1.1.

Update: You also need to disable the transmission of ICMP redirects, since we need all traffic to go through the Pi for shaping to happen. It turns out that the Linux kernel is smart enough to figure out that the clients on your home network could talk directly to the ADSL box, rather than bounce traffic through the Pi, and it tells them this at every opportunity. The clients then send their traffic directly to your ADSL box, and the Pi doesn't get a chance to shape it. Disable it on the fly like so (lost when you next reboot):

  1. Enable IPv4 Forwarding, so your Pi acts as a router by forwarding any traffic it receives
  2. Configure your Pi with static network configuration so it will not be influenced by DHCP changes suggested below. Here are the contents of my /etc/network/interfaces as reference:

    # pi@flux:/home/pi/projects/adsl/rrdlogger (master *)
    # cat /etc/network/interfaces 
    auto lo
    
    iface lo inet loopback
    #iface eth0 inet dhcp
    iface eth0 inet static
            address 192.168.1.1
            netemask 255.255.255.0
            gateway 192.168.1.254    # IP of my ADSL router box
    
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    
  3. Now change your network's DHCP settings such that the default gateway/router is your Pi. This likely means changing the settings on your existing ADSL router box. In my example above, my Pi's IP address is 192.168.1.1.

Update: You also need to disable the transmission of ICMP redirects, since we need all traffic to go through the Pi for shaping to happen. It turns out that the Linux kernel is smart enough to figure out that the clients on your home network could talk directly to the ADSL box, rather than bounce traffic through the Pi, and it tells them this at every opportunity. The clients then send their traffic directly to your ADSL box, and the Pi doesn't get a chance to shape it. Disable it on the fly like so (lost when you next reboot):

2 Fix shaping (egress) by disabling ICMP redirects
source | link

Update: You also need to disable the transmission of ICMP redirects, since we need all traffic to go through the Pi for shaping to happen. It turns out that the Linux kernel is smart enough to figure out that the clients on your home network could talk directly to the ADSL box, rather than bounce traffic through the Pi, and it tells them this at every opportunity. The clients then send their traffic directly to your ADSL box, and the Pi doesn't get a chance to shape it. Disable it on the fly like so (lost when you next reboot):

echo 0 | sudo tee /proc/sys/net/ipv4/conf/*/send_redirects

Update the following to set this during boot: /etc/sysctl.conf

net/ipv4/conf/eth0/send_redirects = 0

(Thanks to http://unix.stackexchange.com/a/58081/22537 for this tip)

You may also be interested in my personal notes on configuring a Linux gateway: http://www.robmeerman.co.uk/unix/gateway

Update: You also need to disable the transmission of ICMP redirects, since we need all traffic to go through the Pi for shaping to happen. It turns out that the Linux kernel is smart enough to figure out that the clients on your home network could talk directly to the ADSL box, rather than bounce traffic through the Pi, and it tells them this at every opportunity. The clients then send their traffic directly to your ADSL box, and the Pi doesn't get a chance to shape it. Disable it on the fly like so (lost when you next reboot):

echo 0 | sudo tee /proc/sys/net/ipv4/conf/*/send_redirects

Update the following to set this during boot: /etc/sysctl.conf

net/ipv4/conf/eth0/send_redirects = 0

(Thanks to http://unix.stackexchange.com/a/58081/22537 for this tip)

You may also be interested in my personal notes on configuring a Linux gateway: http://www.robmeerman.co.uk/unix/gateway

1
source | link
    Post Made Community Wiki by RobM