Use bound_addr when have two NICs

BQ
Bui Quy
Wed, Mar 11, 2020 9:42 AM

Hi,
My computer has two NICs and was configured like below:

auto lo

iface lo inet loopback

auto eth0
iface eth0 inet static
address 172.36.100.12
network 172.36.100.0
netmask 255.255.255.0
broadcast 172.36.100.255
up ip route add 172.36.100.0/24 dev eth0 src 172.36.100.12 table 10
up ip route add default via 172.36.100.1 dev eth0 table 10
up ip rule add from 172.36.100.12 table 10
up ip route add 172.36.100.0/24 dev eth0 src 172.36.100.12

auto eth1
iface eth1 inet static
address 172.36.100.13
network 172.36.100.0
netmask 255.255.255.0
broadcast 172.36.100.255
up ip route add 172.36.100.0/24 dev eth1 src 172.36.100.13 table 20
up ip route add default via 172.36.100.1 dev eth1 table 20
up ip rule add from 172.36.100.13 table 20
up ip route add 172.36.100.0/24 dev eth1 src 172.36.100.13

I wrote a simple application to test the bound_addr with two NICs.

The strange thing is when I call the URI, all the packet I captured with
Wireshark is always sent from either eth0's address or eth1's address, no
matter what bound_addr I set to.
The IP in all headers is as same as bound_addr, except the CONTACT header.
But the call still works.

Then if I unplug the cable of this "default" interfaces, I cannot make the
call but ping is still ok.

My application is in the attachment.
Any advice is welcome.

Bui Danh Quy

Hi, My computer has two NICs and was configured like below: auto lo > iface lo inet loopback > > auto eth0 > iface eth0 inet static > address 172.36.100.12 > network 172.36.100.0 > netmask 255.255.255.0 > broadcast 172.36.100.255 > up ip route add 172.36.100.0/24 dev eth0 src 172.36.100.12 table 10 > up ip route add default via 172.36.100.1 dev eth0 table 10 > up ip rule add from 172.36.100.12 table 10 > up ip route add 172.36.100.0/24 dev eth0 src 172.36.100.12 > > auto eth1 > iface eth1 inet static > address 172.36.100.13 > network 172.36.100.0 > netmask 255.255.255.0 > broadcast 172.36.100.255 > up ip route add 172.36.100.0/24 dev eth1 src 172.36.100.13 table 20 > up ip route add default via 172.36.100.1 dev eth1 table 20 > up ip rule add from 172.36.100.13 table 20 > up ip route add 172.36.100.0/24 dev eth1 src 172.36.100.13 I wrote a simple application to test the bound_addr with two NICs. The strange thing is when I call the URI, all the packet I captured with Wireshark is always sent from either eth0's address or eth1's address, no matter what bound_addr I set to. The IP in all headers is as same as bound_addr, except the CONTACT header. But the call still works. Then if I unplug the cable of this "default" interfaces, I cannot make the call but ping is still ok. My application is in the attachment. Any advice is welcome. *Bui Danh Quy*