1. NIC information didn’t show up correctly when ssh to the nodes

NIC information didn’t show up correctly when ssh to the nodes

Home › Forums › FABRIC General Questions and Discussion › NIC information didn’t show up correctly when ssh to the nodes

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #3597
    Xusheng Ai
    Participant

      Hello,

      We requested a slice with 5 nodes and each node we assigned four ‘NIC_Basic’ components. Here is the slice information of node 1

      
      slice_name = 'Hydra_L2-diff-sites'
      sites = ['UTAH','STAR', 'SALT', 'WASH', 'MICH']
      node1_name = 'Node1'
      node2_name = 'Node2'
      node3_name = 'Node3'
      node4_name = 'Node4'
      node5_name = 'Node5'
      network_name=['net1','net2','net3','net4','net5','net6','net7','net8','net9','net10']
      node1_nic_name = ['nic1_1', 'nic1_2','nic1_3', 'nic1_4']
      node2_nic_name = ['nic2_1','nic2_2', 'nic2_3', 'nic2_4' ]
      node3_nic_name = ['nic3_1','nic3_2', 'nic3_3', 'nic3_4' ]
      node4_nic_name = ['nic4_1','nic4_2', 'nic4_3', 'nic4_4' ]
      node5_nic_name = ['nic5_1','nic5_2', 'nic5_3', 'nic5_4' ]
      image = 'default_ubuntu_20'
      cores = 2
      ram = 8
      disk = 50
      # Node1
      node1 = slice.add_node(name=node1_name, site=sites[0])
      node1.set_capacities(cores=cores, ram=ram, disk=disk)
      node1.set_image(image)
      iface1_1 = node1.add_component(model='NIC_Basic', name=node1_nic_name[0]).get_interfaces()[0]
      iface1_2 = node1.add_component(model='NIC_Basic', name=node1_nic_name[1]).get_interfaces()[0]
      iface1_3 = node1.add_component(model='NIC_Basic', name=node1_nic_name[2]).get_interfaces()[0]
      iface1_4 = node1.add_component(model='NIC_Basic', name=node1_nic_name[3]).get_interfaces()[0]
      

      When the slice state turned stableOK, we printed out the interfaces information. Below is the information of node 1:

      Name	        Node   Network Bandwidth VLAN	MAC	                Device	Device
      Node1-nic1_4-p1	Node1	net4	100	None	06:AC:16:7B:38:FF	ens7	ens7
      Node1-nic1_2-p1	Node1	net2	100	None	06:BA:BC:72:F8:34	ens8	ens8
      Node1-nic1_3-p1	Node1	net3	100	None	0A:ED:E0:7F:C2:B5	ens10	ens10
      Node1-nic1_1-p1	Node1	net1	100	None	0A:70:23:DD:1F:B7	ens9	ens9

      Therefore, for node 1, we was supposed to have four NICs. However, we ssh the node 1 and ran ifconfig command. There was no information about ens 7-10.

      ubuntu@a8dd2195-7dce-4cdc-a8c8-34da897a835c-node1:~$ ifconfig 
      ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
              inet 10.20.4.75  netmask 255.255.254.0  broadcast 10.20.5.255
              inet6 fe80::f816:3eff:fe34:23e  prefixlen 64  scopeid 0x20<link>
              inet6 2001:1948:417:7:f816:3eff:fe34:23e  prefixlen 64  scopeid 0x0<global>
              ether fa:16:3e:34:02:3e  txqueuelen 1000  (Ethernet)
              RX packets 1130  bytes 394337 (394.3 KB)
              RX errors 0  dropped 2  overruns 0  frame 0
              TX packets 1413  bytes 228963 (228.9 KB)
              TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
      
      lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
              inet 127.0.0.1  netmask 255.0.0.0
              inet6 ::1  prefixlen 128  scopeid 0x10<host>
              loop  txqueuelen 1000  (Local Loopback)
              RX packets 697  bytes 62796 (62.7 KB)
              RX errors 0  dropped 0  overruns 0  frame 0
              TX packets 697  bytes 62796 (62.7 KB)
              TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

      We did a test run with example notebook — Create a Local Ethernet (Layer 2) Network, and the nodes did contain NIC information as we ssh to the nodes. We are not sure where went wrongs with our slice.

      • This topic was modified 3 years, 8 months ago by Xusheng Ai.
      • This topic was modified 3 years, 8 months ago by Xusheng Ai.
      • This topic was modified 3 years, 8 months ago by Xusheng Ai.
      #3601
      yoursunny
      Participant

        ifconfig is deprecated since Ubuntu 16.

        Try ip link or ip addr command.

        #3602
        Durbek Gafurov
        Participant

          For some reason, now we have to manually turn up the interface.
          You can first install
          sudo apt install -y net-tools

          and

          sudo ifconfig ens7 up && sudo ifconfig ens8 up && sudo ifconfig ens9 up && sudo ifconfig ens10 up

          Alternatively you can use the code below, to turn on all interfaces
          try:
          for node in slice.get_nodes():
          print(“—-“)
          print(“Node:”)
          print(f” Name : {node.get_name()}”)
          for component in node.get_components():
          print(f” Name : {component.get_name()}”)
          for interface in node.get_interfaces():
          print(f” Name : {interface.get_name()}”)
          stdout, stderr = node.execute(f’sudo apt install -y net-tools && sudo ifconfig {interface.get_os_interface()} up ‘)
          except Exception as e:
          print(f”Fail: {e}”)
          traceback.print_exc()

          #3604
          Xusheng Ai
          Participant

            For some reason, now we have to manually turn up the interface.
            You can first install
            sudo apt install -y net-tools

            and

            sudo ifconfig ens7 up && sudo ifconfig ens8 up && sudo ifconfig ens9 up && sudo ifconfig ens10 up

            Alternatively you can use the code below, to turn on all interfaces
            try:
            for node in slice.get_nodes():
            print(“—-“)
            print(“Node:”)
            print(f” Name : {node.get_name()}”)
            for component in node.get_components():
            print(f” Name : {component.get_name()}”)
            for interface in node.get_interfaces():
            print(f” Name : {interface.get_name()}”)
            stdout, stderr = node.execute(f’sudo apt install -y net-tools && sudo ifconfig {interface.get_os_interface()} up ‘)
            except Exception as e:
            print(f”Fail: {e}”)
            traceback.print_exc()

            Thanks for the information!
            Both methods work well — manually turn up the interface and the code turns on all interfaces.

            #3619
            Xusheng Ai
            Participant

              Is it possible that we can get the MAC address with corresponding NIC?
              For example, below is the information of node 1:

              Name	        Node   Network Bandwidth VLAN	MAC	                Device	Device
              Node1-nic1_4-p1	Node1	net4	100	None	06:AC:16:7B:38:FF	ens7	ens7
              Node1-nic1_2-p1	Node1	net2	100	None	06:BA:BC:72:F8:34	ens8	ens8
              Node1-nic1_3-p1	Node1	net3	100	None	0A:ED:E0:7F:C2:B5	ens10	ens10
              Node1-nic1_1-p1	Node1	net1	100	None	0A:70:23:DD:1F:B7	ens9	ens9

              If there is a way that we can get the MAC address of these four NICs?

              • This reply was modified 3 years, 8 months ago by Xusheng Ai.
              #3621

              Are you using FABlib2 API?

              When you are creating the slice and allocating resources, then you should see your MAC address printed out as well.

               

              #3622
              Xusheng Ai
              Participant

                Yes, The information can be printed.
                When we create layer 3 network connection, we ran the command:

                slice.get_nodes()[2].execute('nfdc face create udp6://[%s]' %slice.get_nodes()[1].get_management_ip())
                

                So we didn’t have to copy and past the network information.

                We was wondering if we could do the same for Layer 2 network connection like:

                slice.get_nodes()[1].execute('nfdc face create remote ether://[%s] local dev://[%s]' [MAC address],[interface.get_os_interface()])
                

                But we are not sure how to acquire MAC address through FABlib API

                • This reply was modified 3 years, 8 months ago by Xusheng Ai.
                • This reply was modified 3 years, 8 months ago by Xusheng Ai.
                • This reply was modified 3 years, 8 months ago by Xusheng Ai.
                #3626

                Oh, okay, then you are trying to create a local ethernet [layer 2] network?

                I think we can also check here, https://fabric-fablib.readthedocs.io/en/latest/genindex.html

                With all available methods

                #3627
                Xusheng Ai
                Participant

                  Thank you so much for the information.

                Viewing 9 posts - 1 through 9 (of 9 total)
                • You must be logged in to reply to this topic.