0

I have multiple network interfaces and I am not sure which interface is being used for the internet connection.

I tried the methods which are listed in the question How to find out which interface am I using for connecting to the internet?, howerver I'm getting multiple "default" network interfaces when I use suggested solutions.

output of route

smc
  • 561
  • 3
  • 10
  • 24
  • 1
    Look at the metric. – dirkt Oct 07 '18 at 19:58
  • If I'm not wrong, as per the wiki - https://en.wikipedia.org/wiki/Metrics_(networking), "The route will go in the direction of the gateway with the lowest metric" (here the interface (ens6) which have 0 metrics), so the answer is ens6? – smc Oct 08 '18 at 10:14
  • Please, [don't post images of text](https://unix.meta.stackexchange.com/questions/4086/psa-please-dont-post-images-of-text). – Kusalananda Mar 04 '19 at 10:13

1 Answers1

2

for ipv4:

ip -o route get 8/8 | grep --color=always 'dev [^ ]*'

for ipv6:

ip -o route get 2000::/3 | grep --color=always 'dev [^ ]*'