Addressing
71
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
Network Addresses
NOTE:
•
Ipv4 is always enabled. IPv6 can also be enabled, but it cannot work without IPv4.
•
During a DHCP IPv4 failure, the SimpleLink device acquires the IPv4 address by using
Local-Link Address protocol (LLA)
•
For power-sensitive systems, TI recommends disabling IPv6.
•
All addressing configurations are persistent and available through the host interface.
5.3.1 IPv4 Addresses
The SimpleLink device allows the following IPv4 acquisition methods:
•
Stateful (DHCPv4) with Stateless (LLA) Fallback –
In this mode, the device starts by trying to
acquire the IPv4 address from a DHCP server. LLA is acquired only after a DHCPv4 client time-out
expires. The default time-out is 25 seconds, and this time can be configured.
NOTE:
•
LLA allows communicating with devices on the local network only.
•
The LLA IP address range is from 169.254.1.0 to 169.254.254.255. The default gateway
and DNS address are not configured.
Example:
_i16 Status;
Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,SL_NETCFG_ADDR_DHCP_LLA,0,0);
if
( Status )
{
// error
}
•
Stateful (DHCPv4) Only –
In this mode, the device tries to acquire the IPv4 address from a DHCP
server with no time-out.
Example:
_i16 Status;
Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,SL_NETCFG_ADDR_DHCP,0,0);
if
( Status )
{
// error
}
•
Static –
In this mode the IPv4 address of the device is preconfigured.
Example:
_i16 Status;
SlNetCfgIpV4Args_t ipV4;
ipV4.Ip
= (_u32)SL_IPV4_VAL(10,1,1,201);
// _u32 IP address
ipV4.IpMask
= (_u32)SL_IPV4_VAL(255,255,255,0);
// _u32 Subnet mask for this STA/P2P
ipV4.IpGateway
= (_u32)SL_IPV4_VAL(10,1,1,1);
// _u32 Default gateway address
ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(8,8,8,8);
// _u32 DNS server address
Status =
sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,SL_NETCFG_ADDR_STATIC,
sizeof
(ipV4),(_u8*)&ipV4);
if
( Status )
{
// error
}