lua-users home
lua-l archive

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


On Sat, Feb 12, 2011 at 11:43 PM, Leo Razoumov wrote:

> On Sat, Feb 12, 2011 at 23:44, Thomas Harning Jr. 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.

I am using pppoe on my machine and "route" tells me 0.0.0.0
is ppp0, but that still doesn't tell me which NIC is ppp0
associated with.

 - Jeff