Separate Network Interfaces

old-hell

Member
Jun 25, 2021
8
0
6
48
Is there a way to separate the network interfaces?

problem:
I'm having a bunch of devices that need to be updated.
To make a kind of load balancing, I want the devices to connect to 4 ethernet ports (bonding is not possible cause the switch is not managed by me).
I'm using bind to make a round-robin, so the first device connects to port 1, the second device connects to port 2 .... this works fine but
only the first port sends the data back. But I need every separate port to send the data back to get the full bandwidth of every port and not only on port.

is there a way to handle that?

best regards.
 
Thank you for the replies.


This is how it works now:


Incoming Traffic Outgoing Traffic

-----eth0-------- ---------eth0--------
------eth1--------
------eth2--------
------eth3--------

This is how it should work:

Incoming Traffic Outgoing Traffic

------eth0-------- ---------eth0--------
------eth1-------- ---------eth1--------
------eth2-------- ---------eth2--------
------eth3-------- ---------eth3--------


So if there is a Request on eth2 it should reply with eth2 and not with eth0.


This is my configuration:

auto eth0
iface eth0 inet static
address 10.62.57.12
netmask 255.255.255.0
gateway 10.62.57.1
dns-nameservers 10.62.60.13

auto eth1
iface eth1 inet static
address 10.62.57.13
netmask 255.255.255.0

auto eth2
iface eth2 inet static
address 10.62.57.14
netmask 255.255.255.0

auto eth3
iface eth3 inet static
address 10.62.57.15
netmask 255.255.255.0
 
Then define a static route for a /32 subnet.
Do you mean, I can do something like this?

auto eth0
iface eth0 inet static
address 10.62.57.12
netmask 255.255.255.0
gateway 10.62.57.1
dns-nameservers 10.62.60.13

auto eth1
iface eth1 inet static
address 10.62.57.13
netmask 255.255.255.0
ip route add 10.62.57.13/32 via 10.62.57.1 dev eth1

auto eth2
iface eth2 inet static
address 10.62.57.14
netmask 255.255.255.0
ip route add 10.62.57.14/32 via 10.62.57.1 dev eth2

auto eth3
iface eth3 inet static
address 10.62.57.15
netmask 255.255.255.0
ip route add 10.62.57.15/32 via 10.62.57.1 dev eth3
 
Something like this yes. Maybe you have to skip the via, since it's not on the subnet, but it should work like this.
 
»not working« is, unfortunately, not a sufficient error description.
I tried this:

auto eth0
iface eth0 inet static
address 10.62.57.12
netmask 255.255.255.0
gateway 10.62.57.1
dns-nameservers 10.62.60.13

auto eth1
iface eth1 inet static
address 10.62.57.13
netmask 255.255.255.0
ip route add 10.62.57.13/32 dev eth1

auto eth2
iface eth2 inet static
address 10.62.57.14
netmask 255.255.255.0
ip route add 10.62.57.14/32 dev eth2

auto eth3
iface eth3 inet static
address 10.62.57.15
netmask 255.255.255.0
ip route add 10.62.57.15/32 dev eth3



I tried this:

auto eth0
iface eth0 inet static
address 10.62.57.12
netmask 255.255.255.0
gateway 10.62.57.1
ip route add 10.62.57.12/32 dev eth0
ip route add 10.62.57.13/32 dev eth1
ip route add 10.62.57.14/32 dev eth2
ip route add 10.62.57.15/32 dev eth3
dns-nameservers 10.62.60.13

auto eth1
iface eth1 inet static
address 10.62.57.13
netmask 255.255.255.0
ip route add 10.62.57.12/32 dev eth0
ip route add 10.62.57.13/32 dev eth1
ip route add 10.62.57.14/32 dev eth2
ip route add 10.62.57.15/32 dev eth3

auto eth2
iface eth2 inet static
address 10.62.57.14
netmask 255.255.255.0
ip route add 10.62.57.12/32 dev eth0
ip route add 10.62.57.13/32 dev eth1
ip route add 10.62.57.14/32 dev eth2
ip route add 10.62.57.15/32 dev eth3

auto eth3
iface eth3 inet static
address 10.62.57.15
netmask 255.255.255.0
ip route add 10.62.57.12/32 dev eth0
ip route add 10.62.57.13/32 dev eth1
ip route add 10.62.57.14/32 dev eth2
ip route add 10.62.57.15/32 dev eth3



I also tried this:

auto eth0
iface eth0 inet static
address 10.62.57.12
netmask 255.255.255.0
gateway 10.62.57.1
ip route add 10.62.57.0/26 dev eth0
ip route add 10.62.57.64/26 dev eth1
ip route add 10.62.57.128/26 dev eth2
ip route add 10.62.57.192/26 dev eth3
dns-nameservers 10.62.60.13

auto eth1
iface eth1 inet static
address 10.62.57.13
netmask 255.255.255.0
ip route add 10.62.57.0/26 dev eth0
ip route add 10.62.57.64/26 dev eth1
ip route add 10.62.57.128/26 dev eth2
ip route add 10.62.57.192/26 dev eth3

auto eth2
iface eth2 inet static
address 10.62.57.14
netmask 255.255.255.0
ip route add 10.62.57.0/26 dev eth0
ip route add 10.62.57.64/26 dev eth1
ip route add 10.62.57.128/26 dev eth2
ip route add 10.62.57.192/26 dev eth3

auto eth3
iface eth3 inet static
address 10.62.57.15
netmask 255.255.255.0
ip route add 10.62.57.0/26 dev eth0
ip route add 10.62.57.64/26 dev eth1
ip route add 10.62.57.128/26 dev eth2
ip route add 10.62.57.192/26 dev eth3


Nothing works. Its always taking just one ethernet interface.
I also tried to change the IP address of the client (for the last version, to check if it works in other subnet ranges)..
 
default via 10.62.57.1 dev enp1s1f0 onlink

10.62.57.0/24 dev enp1s1f1 proto kernel scope link src 10.62.57.13
10.62.57.0/24 dev enp1s2f1 proto kernel scope link src 10.62.57.15
10.62.57.0/24 dev enp1s2f0 proto kernel scope link src 10.62.57.14
10.62.57.0/24 dev enp1s1f0 proto kernel scope link src 10.62.57.12
 
Yeah well, you also have to adjust the netmask of the addresses in that case, because the subnet is calculated from that. You see that there is still /24 in the routes.

I have to admit that I never tried such voodoo, but in theory if you define a netmask of 255.255.255.255 for each iface the routes should be set with /32.
 
I tried Subnetmask 255.255.255.255 and iface /32 but thats not working. now I dont have a connection using ssh to the server. because the subnetmask means only ie ip address 12 is allowed to connect to the server.