I'm using getnameinfo as follows:
ifaddrs *ifaddr = NULL, *ifa = NULL;
int rc, family, insize;
rc = getifaddrs(&ifaddr);
...
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
family = ifa->ifa_addr->sa_family
insize = (family == AF_INET) ?
(int)sizeof(struct sockaddr_in) :
(int)sizeof(struct sockaddr_in6);
char host[HOST_NAME_MAX];
rc = getnameinfo(ifa->ifa_addr, insize,
host, sizeof(host), NULL, 0, NI_NUMERICHOST);
}
...
When the function returns with an IPv6 address, it include the interface appended to the numeric IP address:
fe80::62a4:4cff:fe05:dc1b%eth0
What's the purpose of appending the interface to the numerical IP address?
Is there a flag available that controls the appending of the interface to the IP address?
fe80::* addresses are link-local in scope, which means the address is only valid for that particular network, the same address may reference a difference host on a different network. It is thus meaningless to specify a link-local address without specifying which network adapter. Also, DNS becomes rather meaningless outside of link-local scope such as provided by ZeroConf / multicast-DNS.
Unix hosts tend to specify the adapter by name, Windows hosts will specify the adapter by index. Note that Windows maintains separate interface indexes for IPv4 and IPv6.
Related
I would like to retrieve the public IP address associated with a given network interface. I need to do something like
client = NetworkManagementClient(...)
interface = client.network_interfaces.get('rg', 'nic-name')
ip_config_id = interface[0].public_ip_address.id
ip_config = some_magic(ip_config_id) # What goes here?
return ip_config.ip_address
This question suggests that in order to implement the some_magic routine, I should parse the ID (by splitting on slashes) and call client.public_ip_addresses.get(). This question indicates that I can call resource_client.resources.get_by_uid, but that doesn't return a PublicIPAddress object (I know I can call as_dict on it and get the data that way).
Is there a way to get an object of the appropriate type (in this case PublicIPAddress) from an object's ID in Azure (without manually parsing the ID)?
Update:
Due to this issue: public_ip_address method within NetworkManagementClient will not return values, we cannot fetch the ip address from PublicIPAddress.
So currently, you can use any other workaround, For example:
myip = client.public_ip_addresses.get(" resource_group_name","public_ip_address_name")
print(myip.ip_address)
You can change this line of code ip_config_id = interface[0].public_ip_address.id to something like my_public_ip_address = interface.ip_configurations[0].public_ip_address, then the return type is PublicIPAddress.
For example:
I've set up my routing algorithm from node itself. After this I want to send datagrams from physical layer in that route itself.
For example if my routes are 1 to 2 and 2 to 3 and I want to send a datagram from 1 to 3 I want my datagram to go through 2.
For this routing table for 1 will be as follows:
Routing table for 1
to: 3 nextHop: 2
to: 2 nextHop: 2
to: 1 nextHop: 1
So I want my process msg function to be as follows:
void processMessage(Message msg) {
if (msg instanceof DatagramNtf && msg.protocol == PING_PROTOCOL && msg.to != nodeInfo.addr)
def dG = new DatagramReq(to: routes.nextHop(msg.to), destination: msg.to)
send new DatagramReq(recipient: msg.sender, to: msg.from, protocol: Protocol.DATA)
}
also what routes.nextHop does is takes in the addr of the destination node and from the routing table gets the next hop.
I want to know to how to get the nextHop from routing table.
To send datagrams using route table entries, you need to use router agent, which inturn uses link and phy agents to send your datagram to the destination.Further routing of packets to the destination will be taken care by router agent itself.Hence I don't think you need to determine nextHop here for the to field in DatagramReq.
Your DatagramReq can be as-
router.send new DatagramReq(recipient: msg.sender, to: msg.from, protocol: Protocol.DATA)
Assuming router is the AgentID defined, and value of msg.from is your destination, and there is a valid route in the route table.
Further, nextHop or getNextHop() returns the address of neighbor node.
I am in the process of buying a 25Gbe Card, and evaluating said card at the moment, and I can't seem to get it to receive a 25G Stream of 64 Byte UDP or TCP Packets traffic. Getting heavy packet drops, with dpdk-pktgen stating that It's using as many cores as I have set up. The most difficult thing to find out is why the packets are coming into the MAC but being dropped when they reach the Physical layer itself. Which leads me to believe that the dispersion of the reception of the packets is not being handled correctly. Leading me to believe that RSS is not taking place with the device, under dpdk. IRQ's are dispersed among the cores used in the system, which have been isolcpu'ed to keep the kernel from slating jobs on top of them, and all needed tuning seems to state that it has been done, and things should be moving along, but can't move past this hurdle.
Command run to initialize dpdk-pktgen:
RTE_SDK=../dpdk_Src/share/dpdk/ sudo -E ./app/build/pktgen -c 0x555555555 -n 8 w 03:00.1 -- -T -m '[2-28:29-33].0' -N -P
I read the documentation provided by DPDK RSS but have not been able to see any changes. I've altered the actual driver contained within dpdk's source "$RTE_SDK/drivers/net/mlx5/mlx5-rss.c" and added in the key that it suggests, I've also manipulated the pktgen-port-cfg.c file with the same instructions altering the below snippet of code
const struct rte_eth_conf default_port_conf = {
.rxmode = {
.split_hdr_size = 0,
.header_split = 0, /**< Header Split disabled. */
.hw_ip_checksum = 0, /**< IP checksum offload disabled. */
.hw_vlan_filter = 0, /**< VLAN filtering enabled. */
.hw_vlan_strip = 0, /**< VLAN strip enabled. */
.hw_vlan_extend = 0, /**< Extended VLAN disabled. */
.jumbo_frame = 0, /**< Jumbo Frame Support disabled. */
.hw_strip_crc = 0, /**< CRC stripping by hardware disabled. */
},
.rx_adv_conf = {
.rss_conf = {
.rss_key = NULL,
.rss_key_len = 0,
.rss_hf = ETH_RSS_IP,
},
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
}, };
Changing the rx_adv_conf to reflect the key that i want to use ie.
.rx_adv_conf = {
.rss_conf = {
.rss_key = "65da65da65da65da65da65da65da65da65da65da",
.rss_key_len = 40,
.rss_hf = ETH_RSS_IP,
},
},
The thing is the documenation seems to state that as long as the rss_hf parameter is set, then it will use RSS, internally defined if not explicitly stated. And should that be the case is there a way to validate a per ring reception rate within pktgen, or ethtool or any other tool?
ETH_RSS_IP means we hash flows using source and destination IP. So in order to leverage the RSS the packets you generate should have different source/destination IPs.
I know that CoAP defines some options which can be included in the sending request and each option has their own number. The structure of the CoAP uri request looks like:
coap-URI = "coap:" "//" host [ ":" port ] path-abempty [ "?" query ]
where inside they include some options like: Uri-Host, Uri-Port, Uri-Path, and Uri-Query, and each of them has their own number, ex: 3 for Uri-Host, 11 for Uri Path.... . And I would like to add some more extra options to this CoAP request, for example some options number 256, 257...How can I do that?
Thank you in advanced
Son
I've managed to pass the Option Number 256.
CoapClient client = new CoapClient(...);
Request request = new Request(CoAP.Code.GET, CoAP.Type.NON);
OptionSet optionSet = new OptionSet();
optionSet.addOption(new Option(256, "admin:admin"));
request.setOptions(optionSet);
client.advanced(request); // or async version
client.shutdown();
At resource:
#Override
public void handleGET(CoapExchange exchange) {
OptionSet optionSet = exchange.advanced().getRequest().getOptions();
List<Option> options = optionSet.asSortedList();
options.stream()
.filter(o -> o.getNumber() == 256)
.findFirst()
.ifPresent(o -> System.err.println(o.getNumber() + " " + o.getStringValue()));
}
Output:
256 admin:admin
However, Option Number 256 may not be a proper choice in general:
RFC 7252 The Constrained Application Protocol (CoAP). 12.2. CoAP Option Numbers Registry
The IANA policy for future additions to this sub-registry is split
into three tiers as follows. The range of 0..255 is reserved for
options defined by the IETF (IETF Review or IESG Approval). The
range of 256..2047 is reserved for commonly used options with public
specifications (Specification Required). The range of 2048..64999 is
for all other options including private or vendor-specific ones,
which undergo a Designated Expert review to help ensure that the
option semantics are defined correctly. The option numbers between
65000 and 65535 inclusive are reserved for experiments. They are not
meant for vendor-specific use of any kind and MUST NOT be used in
operational deployments.
I use .net 3.5/c#
I need to get server's IP, I was using this code:
string strHostName = Dns.GetHostName();
IPHostEntry hostInfo = Dns.GetHostEntry(strHostName);
string serverIpParam = hostInfo.AddressList[0].ToString();
return serverIpParam;
However, after a switch to Windows 2008 server, my IP has letter format instead of usual format (digits). MSDN doesn't shed any light on this.
Any ideas what I should change to get the server IP?
Thanks
Did you looked at all the addresses that are returned by hostInfo.AddressList?
When I execute the following in LinqPad:
string strHostName = System.Net.Dns.GetHostName();
System.Net.IPHostEntry hostInfo = System.Net.Dns.GetHostEntry(strHostName);
for(int index=0; index < hostInfo.AddressList.Length; index++) {
Console.WriteLine(hostInfo.AddressList[index]);
}
IT will return me a whole list of network interfaces.
In your case, I think the first entry points to an IPV6 address