I am working on BusyBox v1.31.1. The device has three interfaces eth0,eth1 and eth2. To make all the three interfaces flexible .i.e. to establish internet connectivity via the interface chosen by the user ,three routing tables are designated to all the three ,namely eth0-rt for eth0 , eth1-rt for eth1 and eth2-rt for eth2
I have added all the ip route commands and ip rules as per https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System As per the instructions,following are the commands applied to all the three interfaces
ifconfig eth0 10.184.194.108 netmask 255.255.255.0 broadcast 10.184.194.255 mtu 1500 up
ifconfig eth0 hw ether aa:bb:cc:dd:11:aa
ip route add 10.184.194.0/24 dev eth0 src 10.184.194.108 table eth0-rt
ip route add default via 10.184.194.1 dev eth0 table eth0-rt
ip rule add from 10.184.194.108/32 table eth0-rt
ip rule add to 10.184.194.108/32 table eth0-rt
ifconfig eth1 10.184.194.109 netmask 255.255.255.0 broadcast 10.184.194.255 mtu 400 up
ifconfig eth1 hw ether aa:bb:cc:dd:11:bb
ip route add 10.184.194.0/24 dev eth1 src 10.184.194.108 table eth1-rt
ip route add default via 10.184.194.1 dev eth1 table eth1-rt
ip rule add from 10.184.194.109/32 table eth1-rt
ip rule add to 10.184.194.109/32 table eth1-rt
ifconfig eth2 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 mtu 400 up
ifconfig eth2 hw ether aa:bb:cc:dd:11:cc
ip route add 192.168.1.0/24 dev eth2 src 192.168.1.2 table eth2-rt
ip route add default via 192.168.1.1 dev eth2 table eth2-rt
ip rule add from 192.168.1.2/32 table eth2-rt
ip rule add to 192.168.1.2/32 table eth2-rt
and below is the output of "ip rule show" command ip rule show
Device is placed in the organisation network(which can access internet via proxy). The webpage of device can be accessed via eth0 and eth1 IP via laptop connected in the organisation network while eth2 is a static IP configured in some other network.
Problem statement 1: The network traffic to the device is woking fine via these interfaces(eth0 and eth1),since I can access the device. But "from traffic"(internet connectivity to external servers) via these interfaces are not at all working. I tried
"ip rule from all table eth0-rt"
command and then it started working fine;however the moment I configure "eth2" interface with a different network configuration after adding rules for eth2 interface,I lose the connectivity to the internet,eventhough the rules exist for eth0 and eth1 in the ip rules table. I have tried assigning same preferences for the ip rules of all three interfaces and still it did not work.
Problem statement 2: Will the internet connection from the box work if the user connects any of the three interfaces to the network as per his choice after adding the rules and routing commands to these routing and rule tables.
I have referred to articles ,but everything talks about specific connections like ssh,http and https by adding specific ports in firewall. Also, they mention about how to add rules specific interfaces if used for specific purposes and the priority that should be assigned, which will not be helpful. Is a preference always required among the interfaces when they attempt to establish internet connectivity? Please assist me to solve this issue.