lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, Feb 12, 2011 at 23:44, Thomas Harning Jr. <harningt@gmail.com> wrote:
> Let alone a way to define "default network interface".  Or is there?
> Say I have 2 NICs, which one is default?
>

The one which is associated with a default route is a default interface.
On Linux one can get it via "route -n". From Lua one can use
os.popen("route -n") and then parse the line with 0.0.0.0 destination
(default route) and extract the corresponding interface name.

--Leo--