I am struggling with this for over a week. I am new to the networking so I am learning everything from the start past few days.
I am in need to implement seamless switch between two network interfaces.
For example I have one internal network wifi in my laptop and one external connected through usb. From the internal wifi I connect to one router and from external wifi I connect to mobile hotspot.
So I each wifi adapter has assigned it's own IP from different subnet and different default gateway.
I discovered that something like this should be doable with bonding. So I started to work on this solution. Spent few days on learning some basing routing stuff and I finally almost have it working with last detail on which I am stuck for three days and I am not even sure that it can be done..
Lets say I have two default gateway:
first - 192.168.2.1
second - 192.168.3.1
So I have this in my /etc/network/interfaces file:
auto bond0
iface bond0 inet static
address 192.168.1.10
netmask 255.255.255.0
auto enp0s3
iface enp0s3 inet manual
auto enp0s8
iface enp0s8 inet manual
I setup links with bonding, bonding mode, etc..
I add some routes
routes
with this setup when I ping some IP on the internet, my wireshark endlessly saying on icmp requets: no response found!
but when I add this:
ifconfig bond0:1 192.168.2.10 netmask 255.255.255.0
ifconfig bond0:2 192.168.3.10 netmask 255.255.255.0
bonding is working fine and when I turn off one of the NICs bonding automatically switch to another (I am running with active-backup) and internet is working.. But the only reason I am doing this is to get seamless download. Lets say I am downloading huge file and using one NIC and it fails so I want that second NIC will be automatically used and my download will continue. But with this setup the download fails because my bonding interface is using either bond0:1 or bond0:2 IP based on the active slave. So when there is a change to new slave my IP change and download fails...
So from what I read, I understand that if I want also my download to seamlessly continue my IP must remain the same when a slave changes..
So I need to remove these two:
ifconfig bond0:1 192.168.2.10 netmask 255.255.255.0
ifconfig bond0:2 192.168.3.10 netmask 255.255.255.0
then my bonding interface allways uses the static ip 192.168.1.10, but with this I am getting: no response found.
I tried some forwarding, nat stuff with ip tables and other stuff I found but nothing worked for me. Am I missing only some small piece to get it going ? Or it can't be done ? I need to implemented a solution without any additional routers or additional settings on the existng routers. It must be a purely setup on my machine.
Is this possible ?
Thanks a lot for every answer.