Sample Header Ad - 728x90

How to separate the traffic of 3 network interfaces

0 votes
1 answer
109 views
How to separate the traffic of 3 network interfaces on Ubuntu 22.04
eno1: flags=4163  mtu 1500
        inet 192.168.1.48  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::8276:83ab:72d6:1287  prefixlen 64  scopeid 0x20
        ether 9c:53:22:48:77:19  txqueuelen 1000  (Ethernet)
        RX packets 7797  bytes 1129504 (1.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6828  bytes 593700 (593.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp8s0: flags=4163  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::b875:1df4:ff5e:9f09  prefixlen 64  scopeid 0x20
        ether d8:5e:d3:01:84:ed  txqueuelen 1000  (Ethernet)
        RX packets 135512185  bytes 8949006996 (8.9 GB)
        RX errors 0  dropped 237  overruns 235  frame 0
        TX packets 365038054  bytes 534261499563 (534.2 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfa800000-fa81ffff  

enp9s0: flags=4163  mtu 1500
        inet 192.168.1.36  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 2403:6200:89a6:d09d:5606:aae2:c339:9eb1  prefixlen 64  scopeid 0x0
        inet6 2403:6200:89a6:d09d:d5ac:2515:913e:e2be  prefixlen 64  scopeid 0x0
        inet6 fe80::272a:26bd:9d12:e881  prefixlen 64  scopeid 0x20
        ether d8:5e:d3:01:84:ee  txqueuelen 1000  (Ethernet)
        RX packets 274876935  bytes 23805585708 (23.8 GB)
        RX errors 0  dropped 1956  overruns 0  frame 0
        TX packets 740203694  bytes 1081935809783 (1.0 TB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
enp8s0 already works separately by default, connected through 192.168.0.1 It has been working smoothly with enp9s0 which connected through 192.168.1.1 Then I added eno1 and the problem occurred. All the network interfaces are connected to different routers which are of 3 different ISPs eno1 is of additional LAN pcie card while enp8s0 and enp9s0 are of onboard LAN slot Here is my ip route result
default via 192.168.1.1 dev enp9s0 proto dhcp metric 100 
default via 192.168.0.1 dev enp8s0 proto dhcp metric 102 
default via 192.168.1.1 dev eno1 proto dhcp metric 103 
169.254.0.0/16 dev enp8s0 scope link metric 1000 
192.168.0.0/24 dev enp8s0 proto kernel scope link src 192.168.0.101 metric 102 
192.168.1.0/24 dev enp9s0 proto kernel scope link src 192.168.1.36 metric 100 
192.168.1.0/24 dev eno1 proto kernel scope link src 192.168.1.48 metric 103
Since enp9s0 connected to ISP1, enp8s0 connected to ISP2 and eno1 connected to ISP3 I want the traffics of these 3 to go out separately according to their ISP. When I curl they gone separately
money@money:~$ curl --interface enp8s0 ifconfig.me
101.108.144.237
money@money:~$ curl --interface enp9s0 ifconfig.me
14.207.43.37
money@money:~$ curl --interface eno1 ifconfig.me
171.100.22.228
But when I use rclone to upload files it stuck This happened before when I first added enp8s0, before that I only had 1 network interface which is enp9s0 now I had to
sudo ip route add 192.168.0.0/24 dev enp8s0 src 192.168.0.101 table rt2
sudo ip route add default via 192.168.0.1 dev enp8s0 table rt2
sudo ip rule add from 192.168.0.101/32 table rt2
sudo ip rule add to 192.168.0.101/32 table rt2
and solved it Now I added eno1 and had the forementioned problem again So I tried both
sudo ip route add 192.168.1.0/24 dev eno1 src 192.168.1.48 table rt2
sudo ip route add default via 192.168.1.1 dev eno1 table rt2
sudo ip rule add from 192.168.1.48/32 table rt2
sudo ip rule add to 192.168.1.48/32 table rt2
and
sudo ip route add 192.168.1.0/24 dev eno1 src 192.168.1.48 table rt3
sudo ip route add default via 192.168.1.1 dev eno1 table rt3
sudo ip rule add from 192.168.1.48/32 table rt3
sudo ip rule add to 192.168.1.48/32 table rt3
But still can't make it through Additional information when ip route list table
money@money:~$ ip route list table rt2
default via 192.168.0.1 dev enp8s0 
192.168.0.0/24 dev enp8s0 scope link src 192.168.0.101 
192.168.1.0/24 dev eno1 scope link src 192.168.1.48 
money@money:~$ ip route list table rt3
default via 192.168.0.1 dev enp8s0 
192.168.0.0/24 dev enp8s0 scope link src 192.168.0.101 
192.168.1.0/24 dev eno1 scope link src 192.168.1.48
When cat /etc/iproute2/rt_tables
#
# reserved values
#
255	local
254	main
253	default
0	unspec
#
# local
#
#1	inr.ruhep
1 rt2
1 rt3
ip a result
2: enp9s0:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d8:5e:d3:01:84:ee brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.36/24 brd 192.168.1.255 scope global dynamic noprefixroute enp9s0
       valid_lft 9272sec preferred_lft 9272sec
    inet6 2403:6200:89a6:d09d:5606:aae2:c339:9eb1/64 scope global temporary dynamic 
       valid_lft 581671sec preferred_lft 62705sec
    inet6 2403:6200:89a6:d09d:d5ac:2515:913e:e2be/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 863871sec preferred_lft 431871sec
    inet6 fe80::272a:26bd:9d12:e881/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: enp8s0:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether d8:5e:d3:01:84:ed brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.101/24 brd 192.168.0.255 scope global dynamic noprefixroute enp8s0
       valid_lft 63271sec preferred_lft 63271sec
    inet6 fe80::b875:1df4:ff5e:9f09/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: eno1:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 9c:53:22:48:77:19 brd ff:ff:ff:ff:ff:ff
    altname enp10s0
    inet 192.168.1.48/24 brd 192.168.1.255 scope global dynamic noprefixroute eno1
       valid_lft 82853sec preferred_lft 82853sec
    inet6 fe80::8276:83ab:72d6:1287/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
Comparing 3 interfaces when uploading with rclone. First one going through enp9s0 without adding --bind option so the connection gone through default line, this one doesnt have problem
money@money:~$ rclone move --verbose --transfers 2 --checkers 6 --bwlimit 1G --contimeout 120s --timeout 600s --retries 6 --low-level-retries 20 --buffer-size 128M --drive-chunk-size 128M --stats 1s /media/cache/vipx3 up:
2023/03/11 18:31:15 INFO  : Starting bandwidth limiter at 1Gi Byte/s
2023/03/11 18:31:16 INFO  : 
Transferred:   	          0 B / 74.568 GiB, 0%, 0 B/s, ETA -
Checks:                 0 / 1, 0%
Transferred:            0 / 1, 0%
Elapsed time:         1.0s
Checking:

Transferring:
 * plot-k32-c7-2023-03-11…8a61bb6c66fc76752.plot:  0% /74.568Gi, 0/s, -

2023/03/11 18:31:18 INFO  : 
Transferred:   	   52.871 MiB / 74.568 GiB, 0%, 20.327 MiB/s, ETA 1h2m33s
Checks:                 0 / 1, 0%
Transferred:            0 / 1, 0%
Elapsed time:         3.0s
Checking:

Transferring:
 * plot-k32-c7-2023-03-11…8a61bb6c66fc76752.plot:  0% /74.568Gi, 20.327Mi/s, 1h2m33s
This one going through enp8s0 (192.168.0.101) also gone through after added the ip route rule mentioned eariler
money@money:~$ rclone move --bind 192.168.0.101 --verbose --transfers 2 --checkers 6 --bwlimit 1G --contimeout 120s --timeout 600s --retries 6 --low-level-retries 20 --buffer-size 128M --drive-chunk-size 128M --stats 1s /media/cache/vipx3 up:
2023/03/11 18:28:39 INFO  : Starting bandwidth limiter at 1Gi Byte/s
2023/03/11 18:28:40 INFO  : 
Transferred:   	          0 B / 74.568 GiB, 0%, 0 B/s, ETA -
Checks:                 0 / 1, 0%
Transferred:            0 / 1, 0%
Elapsed time:         1.0s
Checking:

Transferring:
 * plot-k32-c7-2023-03-11…8a61bb6c66fc76752.plot:  0% /74.568Gi, 0/s, -

2023/03/11 18:28:42 INFO  : 
Transferred:   	   51.184 MiB / 74.568 GiB, 0%, 21.965 MiB/s, ETA 57m54s
Checks:                 0 / 1, 0%
Transferred:            0 / 1, 0%
Elapsed time:         3.0s
Checking:

Transferring:
 * plot-k32-c7-2023-03-11…8a61bb6c66fc76752.plot:  0% /74.568Gi, 21.965Mi/s, 57m54s
This is the last network interface (eno1) I added which couldnt upload right now
money@money:~$ rclone move --bind 192.168.1.48 --verbose --transfers 2 --checkers 6 --bwlimit 1G --contimeout 120s --timeout 600s --retries 6 --low-level-retries 20 --buffer-size 128M --drive-chunk-size 128M --stats 1s /media/cache/vipx3 up:
2023/03/11 18:27:52 INFO  : Starting bandwidth limiter at 1Gi Byte/s
2023/03/11 18:27:53 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Elapsed time:         1.0s

2023/03/11 18:27:54 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Elapsed time:         2.0s

2023/03/11 18:27:55 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Elapsed time:         3.0s

2023/03/11 18:27:56 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Elapsed time:         4.0s
How do I make eno1 traffic going through its own gateway like enp8s0? This line has its own router connected to its own separated ISP. Now it seems to be sharing 192.168.1.1 with enp9s0
Asked by God of Money (23 rep)
Mar 11, 2023, 10:18 AM
Last activity: Mar 11, 2023, 07:08 PM