-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Node: 6.9.1
network: 0.4.0
I have this situation where eth0 has two IP addresses (one assigned by DHCP and the other is a link-local address assigned by systemd-networkd), but get_interfaces_list() returns the IP of the DHCP address with the netmask of the link-local address.
{
"name": "eth0",
"ip_address": "192.168.2.116",
"mac_address": "5c:f8:21:0f:40:d8",
"gateway_ip": "192.168.2.1",
"netmask": "255.255.0.0",
"type": "Wired"
}Output from os.networkInterfaces()
> os.networkInterfaces()
{ lo:
[ { address: '127.0.0.1',
netmask: '255.0.0.0',
family: 'IPv4',
mac: '00:00:00:00:00:00',
internal: true } ],
eth0:
[ { address: '169.254.123.48',
netmask: '255.255.0.0',
family: 'IPv4',
mac: '5c:f8:21:0f:40:d8',
internal: false },
{ address: '192.168.2.116',
netmask: '255.255.255.0',
family: 'IPv4',
mac: '5c:f8:21:0f:40:d8',
internal: false } ] }Output from ip -o -4 addr show eth0:
2: eth0 inet 169.254.123.48/16 brd 169.254.255.255 scope link eth0\ valid_lft forever preferred_lft forever
2: eth0 inet 192.168.2.116/24 brd 192.168.2.255 scope global dynamic eth0\ valid_lft 1803687sec preferred_lft 1803687secThis also poses the question: How can I grab a specific IP address for an interface using network? In my application for example, I am interested in the scope global address when available, otherwise in the scope local address.
Metadata
Metadata
Assignees
Labels
No labels