I have the following interfaces
eth0 192.168.1.178 subnet mask 255.255.255.0 default gateway 192.168.1.1 eth1 10.4.0.6 subnet mask 255.255.255.252 default gateway 10.4.0.5
I want eth1 only can communicate with 10.4.0.5/30 network, rest of the traffic should go through 192.168.1.1 . In this setup I can't ssh to 10.64.0.0/30 network.
How can I configure my routing table for this setup?
These are my current settings:
cat /etc/network/interfaces
interfaces(5) file used by ifup(8) and ifdown(8) Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff inet 192.168.1.178/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0 valid_lft 547025sec preferred_lft 547025sec inet6 fe80::d50:e658:eec:9444/64 scope link noprefixroute valid_lft forever preferred_lft forever 7: eth1: <BROADCAST,MULTICAST,NOARP,UP,LOWER_UP> mtu 1436 qdisc pfifo_fast state UP group default qlen 1000 link/ether YY:YY:YY:YY:YY:YY brd ff:ff:ff:ff:ff:ff inet 10.64.0.6/30 brd 10.64.0.7 scope global dynamic noprefixroute eth1 valid_lft 5835sec preferred_lft 5835sec
route -n
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0 0.0.0.0 10.64.0.5 0.0.0.0 UG 101 0 0 eth1 0.0.0.0 10.64.0.5 0.0.0.0 UG 102 0 0 eth1 10.64.0.4 0.0.0.0 255.255.255.252 U 101 0 0 eth1 192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0