IPRoute2

From Wildsong
Jump to navigationJump to search
#Create an alias to call our table
echo 10 ovpn >> /etc/iproute2/rt_tables

# When packets come in from the LAN, send them to the custom table 
ip rule add from 192.168.4.0/24 table ovpn

# Allow direct access to the other end of the tunnel
ip route add 10.8.0.0/27 via 10.8.0.5 dev tun0 table ovpn
# Route packets for the Ubiquiti radio direct to the WAN port
ip route add 192.168.1.20 via 192.168.1.1 dev eth1 table ovpn

# When packets are destined for the CDS network, send then to the tunnel
ip route add 192.168.2.0/24 via 10.8.0.5 dev tun0 table ovpn

# When they are destined for the LAN, send them to it.
ip route add 192.168.4.0/24 via 192.168.4.254 dev br-lan table ovpn

# Everything else goes to the Internet router
ip route add default via 192.168.1.1 dev eth1 table ovpn

ip route show table ovpn
ip route flush cache