Solved

Fail to add address ip address on interface using net add interface eth ip address command


Hello,

I run cumulus as a VM and have an issue with assigning ip address on interface eth2 using "net add interface eth2 ip address 2.2.2.2/32"


My ifconfig:
code:
~# ifconfig 
eth0 Link encap:Ethernet HWaddr 00:50:56:26:2b:08
inet addr:10.213.43.8 Bcast:10.213.255.255 Mask:255.255.0.0
inet6 addr: fe80::250:56ff:fe26:2b08/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19646283 errors:0 dropped:9 overruns:0 frame:0
TX packets:559190 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2771034260 (2.5 GiB) TX bytes:76014118 (72.4 MiB)

eth1 Link encap:Ethernet HWaddr 24:8a:07:b1:ba:4c
inet6 addr: fe80::268a:7ff:feb1:ba4c/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:43622 errors:0 dropped:0 overruns:0 frame:0
TX packets:2976 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2648365 (2.5 MiB) TX bytes:752335 (734.7 KiB)

eth2 Link encap:Ethernet HWaddr 24:8a:07:b1:ba:4d
inet6 addr: fe80::268a:7ff:feb1:ba4d/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:42816 errors:0 dropped:0 overruns:0 frame:0
TX packets:2881 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2598791 (2.4 MiB) TX bytes:733415 (716.2 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:18 errors:0 dropped:0 overruns:0 frame:0
TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1268 (1.2 KiB) TX bytes:1268 (1.2 KiB)


My /etc/network/interfaces
code:
root@reg-r-vrt-043-008:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*.intf

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp


auto eth1
iface eth1
link-autoneg on

auto eth2
iface eth2
link-autoneg on


Then after assigning ip addresses have an error "ERROR: eth2 is not a physical interface on this switch."
code:
root@reg-r-vrt-043-008:~# net add interface eth1 ip address 1.1.1.1/32

root@reg-r-vrt-043-008:~# net add interface eth2 ip address 2.2.2.2/32
ERROR: eth2 is not a physical interface on this switch.
root@reg-r-vrt-043-008:~# net commit

And print one more time ifconfig
code:
~# ifconfig 
eth0 Link encap:Ethernet HWaddr 00:50:56:26:2b:08
inet addr:10.213.43.8 Bcast:10.213.255.255 Mask:255.255.0.0
inet6 addr: fe80::250:56ff:fe26:2b08/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19648597 errors:0 dropped:9 overruns:0 frame:0
TX packets:559550 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2771376652 (2.5 GiB) TX bytes:76060118 (72.5 MiB)

eth1 Link encap:Ethernet HWaddr 24:8a:07:b1:ba:4c
inet addr:1.1.1.1 Bcast:0.0.0.0 Mask:255.255.255.255
inet6 addr: fe80::268a:7ff:feb1:ba4c/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:43622 errors:0 dropped:0 overruns:0 frame:0
TX packets:2976 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2648365 (2.5 MiB) TX bytes:752335 (734.7 KiB)

eth2 Link encap:Ethernet HWaddr 24:8a:07:b1:ba:4d
inet6 addr: fe80::268a:7ff:feb1:ba4d/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:42816 errors:0 dropped:0 overruns:0 frame:0
TX packets:2881 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2598791 (2.4 MiB) TX bytes:733415 (716.2 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:18 errors:0 dropped:0 overruns:0 frame:0
TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1268 (1.2 KiB) TX bytes:1268 (1.2 KiB)



I found some workarounds for that:
  1. ifconfig eth2 2.2.2.2 netmask 255.255.255.255 and ip addr del 2.2.2.2/32 dev eth2
  2. Use vtysh for configuration.
icon

Best answer by Eric Pulvino 17 July 2018, 22:28

Editing /etc/network/interfaces would be the correct approach here. That way the configuration would be stored persistently across reboots.

I would not call this a defect. NCLU is behaving as intended.
Eth2 is not a real interface on a Cumulus platform. It may be worth it to look at whatever hypervisor you're using to simulate and look at addressing why you have an Eth2 interface.

Interfaces in VX (by default) are remapped according to the following script: /etc/hw_init.d/S10rename_eth_swp.sh

This script ensures that eth2 should never exist unless you're manually modifying Udev files which I'm guessing you are not.

What hypervisor are you using? Can you tell me a little more about your simulation setup?

View original

3 replies

Userlevel 5
Thank you for opening this ticket. This is a known limitation with NCLU on virtual platforms that are using interfaces which are not normally found in CL (i.e. eth2).

Regarding your workarounds:

I found some workarounds for that:
1). ifconfig eth2 2.2.2.2 netmask 255.255.255.255 and ip addr del 2.2.2.2/32 dev eth2

Ifconfig has been deprecated since 2002 use the `ip addr` commands for this:
ip addr show
ip -s addr show
ip addr add 2.2.2.2/32 dev eth2
ip addr del 2.2.2.2/32 dev eth2

2). Use vtysh for configuration.

Don't do this as it's very bad for a number of reasons...
When Vtysh isn't running your IPs are not present.
Makes troubleshooting very precarious as most people are not expecting to find IPs here.
Thanks Eric for your suggestion with ip addr.
Do you know if cumulus team plan to fix a net add ip address command?
And one more question:
if I changed ip address using ip addr command, it is not present in /etc/network/interfaces but present in ifconfig output. Then if I do net commit or ifreload -a, the configuration on eth2 is lost. Is there any save the configuration except edit /etc/network/interfaces?
Userlevel 5
Editing /etc/network/interfaces would be the correct approach here. That way the configuration would be stored persistently across reboots.

I would not call this a defect. NCLU is behaving as intended.
Eth2 is not a real interface on a Cumulus platform. It may be worth it to look at whatever hypervisor you're using to simulate and look at addressing why you have an Eth2 interface.

Interfaces in VX (by default) are remapped according to the following script: /etc/hw_init.d/S10rename_eth_swp.sh

This script ensures that eth2 should never exist unless you're manually modifying Udev files which I'm guessing you are not.

What hypervisor are you using? Can you tell me a little more about your simulation setup?

Reply