Configure Hosts in the Fabric
Typically ONOS can discover hosts via ARP or NDP (when using IPv6) or DHCP messages (when using dhcp-relay app) from the hosts.
In certain scenarios, it may be necessary to configure host information in ONOS via the 'netcfghostprovider' app. Assuming DHCP is not being used, and a host does not 'speak' via ARP or NDP, ONOS would not know the location of this host until it speaks. At this point, if there is some other end-point trying to reach this host, traffic will be black-holed. Of course, one way to get around this is to always use a DHCP relay/server, so ONOS will become aware of the host IP as soon as the DHCP server assigns and acks the IP offer/request.
Another way - eg. in CORD - when an orchestrator is assigning IPs to hosts, it can additionally configure the host information in ONOS as well. This is done via the 'netcfghostprovider' app.
Host configuration via netcfg is shown below.
"hosts" : { "00:00:00:00:00:01/-1" : { "basic": { "ips": ["10.6.1.1"], "locations": ["of:0000000000000001/1"] } } }
line 2: Host is identified by mac-address/vlan tuple. In this case vlan -1 means there's no vlan tag.
line 4: IP address of the host. There can be multiple IP addresses.
line 5: The switchport to which this host attaches is identified by device-id/port-number tuple.
Configure the Host Network Interface
Note that when you configure switch ports with subnet information, the hosts in these subnets also need to be configured with the same subnet information. This is irrespective of whether you expect the host to be discovered by ONOS, or you are configuring host information into ONOS (as described in the section above).
The user needs to ensure that the host routing table conforms to the switchport configuration. Consider the following example
Configure the IP address and subnet mask
Make sure the IP address and the subnet mask on the host network interface connected to the leaf (eg. eth1 in this example) is consistent with the switchport config on the fabric.
For example, if the fabric switchport is configured for the 10.0.1.0/24 subnet and a gateway IP of 10.0.1.254, the interface 'eth1' on the host should have the following configuration. We assume the host-IP in this example is 10.0.1.10 on eth1ip addr add 10.0.1.10/24 dev eth1
Configure the default route in the host routing table
Make sure the default route of the host is set via the gateway IP of the leaf switch interface it connects to.
For example, you can runip route add default via 10.0.1.254
In this case, the host will try to reach all other dst-IPs outside its subnet (10.0.1.0/24) via the gateway 10.0.1.254 reachable via the device/interface eth1.Configure the management subnet
Typically hosts also have a management interface (say eth0) that is accessible via a different management network that is different from the dataplane network (fabric). For example, assume the management interface (eth0) is 10.128.0.211/16, and a few other networks (say 10.1.8.0/22 and 10.3.1.0/26) are reachable by the router (10.128.0.1) on the management network.
ip addr add 10.128.0.211/16 dev mgmt0 ip route add 10.1.8.0/22 via 10.128.0.1 ip route add 10.3.1.0/26 via 10.128.0.1
Note that with this config, host access to the internet happens via the dataplane intf ('eth1') not the management intf ('eth0'). Of course this means that the fabric should be connected to an external router to provide such access. The host routing table looks like this:
admin@h1:~$ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.0.1.254 0.0.0.0 UG 0 0 0 eth1 10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 10.1.8.0 10.128.0.1 255.255.252.0 UG 0 0 0 eth0 10.3.1.0 10.128.0.1 255.255.255.128 UG 0 0 0 eth0 10.128.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0