split routing with two PPPoE connections

1

I have a debian wheezy box running, which is supposed to function as router / firewall / webserver / samba server [...]. I have two accounts from my ISP: acc1 with one static IP, and acc2 with dynamic IPs. The box has two ethernet cards, eth0 and eth1. eth0 is connected to my modem, eth1 to my switch. eth1: ip: 192.168.2.1 netmask: 255.255.255.0 subnet: 192.168.2.0

I set up dnsmasq, basic iptables to allow connections, and both pppoe connections; now I can connect my devices at home to the debian box.

There I set up iproutes to enable internet access. I set the default in main to be ppp1 (static), and now I want to route the subnet 192.168.2.0/24 through ppp2.

# ip rule add from 192.168.2.0/24 table Homenet
# ip route add default via 168.95.98.254 dev ppp2 table Homenet

168.95.98.254 is the gateway through which the pppoe connections connect.

This does not work. As soon as I those settings take effect, my clients cannot ping the internet or 192.168.2.1 anymore. They can, however, ping 168.95.98.254.

BUT when I replace 192.168.2.0/24 in the command above with one of my clients IPs, everything works seemlessly, my client connecting through a dynamic IP, while the others still use the static IP.

What did I miss(-understand)?

Thanks for any help!

here are some outputs:

~$ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp2
168.95.98.254   0.0.0.0         255.255.255.255 UH    0      0        0 ppp2
168.95.98.254   0.0.0.0         255.255.255.255 UH    0      0        0 ppp1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

~$ sudo ip rule list
0:      from all lookup local 
32763:  from 192.168.2.0/24 lookup Homenet 
32764:  from 192.168.2.239 lookup Claire 
32766:  from all lookup main 
32767:  from all lookup default

~$ sudo ip route list table Claire
default via 168.95.98.254 dev ppp2  # this one works! the same on table Homenet works not.

~$ sudo ip route list
default dev ppp2  scope link 
168.95.98.254 dev ppp2  proto kernel  scope link  src xx.xxx.170.105 
168.95.98.254 dev ppp1  proto kernel  scope link  src xxx.xx.85.229 
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.1 

I did ask this on the debian forums before, but no networking gurus emerged, thus I thought I might as well try here.

foaly

Posted 2014-03-17T19:41:59.927

Reputation: 121

Answers

1

To wrap this up: I found help on the lartc mailing list pretty quickly. My final ip rules and ip routes are as follows:

$ ip rule ls
0:      from all lookup local 
32763:  from all iif ppp2 lookup Homenet 
32764:  from all iif eth1 lookup Homenet 
32766:  from all lookup main 
32767:  from all lookup default

$ ip route ls
default dev ppp1  scope link 
168.95.98.254 dev ppp2  proto kernel  scope link  src w.x.y.z 
168.95.98.254 dev ppp1  proto kernel  scope link  src a.b.c.d 
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.1

$ ip route ls table Homenet
default dev ppp2  scope link 
192.168.2.0/24 dev eth1  scope link

all running smoothly now. :)

foaly

Posted 2014-03-17T19:41:59.927

Reputation: 121