From f9c5c6f127d92bf9bbf695e19a12ffbb9d2f6a36 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 6 Feb 2021 19:03:13 +0100 Subject: Get the default interface from route. --- common/IFCFG.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/IFCFG.pm b/common/IFCFG.pm index a9a13037..ca9cb71e 100644 --- a/common/IFCFG.pm +++ b/common/IFCFG.pm @@ -64,7 +64,9 @@ sub is_dhcp { #- TODO : return the main interface sub default_itf { - "eth0"; + $_ = `/sbin/route | grep default | tr -s " " | cut -d " " -f8`; + s/\n$//; + "$_"; } sub itf_get { -- cgit v1.2.1