I have a little complex network setup and I am trying to use a raspberry as a router between three networks with static routes. Please find below a picture of the current set up.

Current SetUp

Basically this means that I have a Raspberry Pi with 3 network interfaces:

  • Eth0: IP connected to a Firewall/VPN hardware. All connections to should go via this interface
  • Eth2: IP connected to a router which connects to the internet
  • Eth1: connected to the local network

All these IP addresses are static. I also already set the static route on the Raspberry for the 84 rule:

route add -net gw

I also deleted the default gateway for eth0

route del default gw eth0

My routing table now looks like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    204    0        0 eth2       UG    0      0        0 eth0   U     202    0        0 eth0   U     204    0        0 eth2   U     203    0        0 eth1

IP Route output

default via dev eth2  metric 204 via dev eth0 dev eth0  proto kernel  scope link  src  metric 202 dev eth2  proto kernel  scope link  src  metric 204 dev eth1  proto kernel  scope link  src  metric 203

If I do a traceroute on an IP with 84 on the Raspberry it looks correct, the traffic is routed via eth0, all other traffic is routed via eth2.

traceroute to (, 30 hops max, 60 byte packets
 1 (  9.253 ms  9.047 ms  8.786 ms
 2 (  34.397 ms  34.840 ms  34.753 ms

I have also set

net.ipv4.ip_forward = 1

The problem is that, if I connect via a PC (e.g. PC1) to the network I am not able to get internet access. The gateway for the PCs is set to

I assume I now have to create static routes for eth1 also on the Raspberry but I am kind of stuck.

Can somebody help me how to finish this set up so that it works?

  • Next time, could you please use the output of ip route instead? The BSD route tool doesn't always show all details on Linux. Apr 6, 2017 at 18:20
  • 1
    Check your routing table on the router that connects to the internet. You need to have static routes set up on that router too otherwise the router won't know where to send a packet to when it sees IP address 192.168.99.x. Thus the packet will be dropped which leads us to no internet connection. Apr 6, 2017 at 18:22
  • I have added the ip route to the description now Apr 6, 2017 at 18:42

1 Answer 1


The routing on the Raspberry Pi is probably OK. You need to make sure that your Internet-facing router has a route for 192.168.99.* that points to Also, you will need to have your Firewall/VPN NAT (PAT) source IPs from 192.168.99.* to an IP on the serial link between the Firewall/VPN and your Router.

If the Router receives packets with the source IP of 192.168.99.* it will always route the reply packets to the same gateway, which in your case is probably, not the IP of the Firewall/VPN.

  • Hi. Thanks for your answer. Can you help me a little more here. How can I link my source IPs from 192.168.99.* to an IP on the serial link between the Firewall/VPN and your Router? Do I need to do this via iptables? Apr 10, 2017 at 18:22

You must log in to answer this question.

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