I got two internet connections... second one doesn't work without routing changes... other thing is that one user has routing through one connection, and other through other... so I need to apply iptables rules for that every time ethernet connects... when I apply it only on start, it gets deleted when for example router is being reboot.
How do I properly run a script after interface gets connected on Raspbian Jessie?
interfaces file doesn't seem to work (doesn't run at all)
post-up.d scripts from
I also tried
iptables-persistant instead of manually running my script, but it doesn't seem to work... I have no idea why... ok, I got some idea... but it may be totally wrong (see comments) ... anyway, when I save rules, restart interface, reset rules to saved, it doesn't work. I need to run my script using
ip command to add all records and make it work again.
My script looks like this (removed user part):
ip route add 192.168.1.0/24 dev eth0 src 192.168.1.200 table NETWORK1 ip route add 192.168.2.0/24 dev eth1 src 192.168.2.200 table NETWORK2 ip route add default via 192.168.1.1 table NETWORK1 ip route add default via 192.168.2.1 table NETWORK2 ip rule add from 192.168.1.1 table NETWORK1 ip rule add from 192.168.2.1 table NETWORK2 ip rule add to 192.168.1.1 table NETWORK1 ip rule add to 192.168.2.1 table NETWORK2 ip rule add from all lookup main suppress_prefixlength 0 ip rule add from 192.168.1.0/24 lookup NETWORK1 ip rule add from 192.168.2.0/24 lookup NETWORK2
I also tried to put a test script into
/etc/dhcp/dhclient-enter-hooks.d, but those scripts seem to not to be used at all anymore (they never run).