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 18.104.22.168 dev ppp2 table Homenet
22.214.171.124 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 126.96.36.199.
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 188.8.131.52 0.0.0.0 255.255.255.255 UH 0 0 0 ppp2 184.108.40.206 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 220.127.116.11 dev ppp2 # this one works! the same on table Homenet works not. ~$ sudo ip route list default dev ppp2 scope link 18.104.22.168 dev ppp2 proto kernel scope link src xx.xxx.170.105 22.214.171.124 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.