EzDevInfo.com

nic interview questions

Top nic frequently asked interview questions

Is there any way of an app in Linux have access to 2 network cards?

My app needs to access two network cards. One to receive data (eth0) and another to send data (3G modem).

Normally, the kernel force the app to work with only one card at a time.

Is there any thing that I can do to make it run?

Thank you.


Source: (StackOverflow)

programmatically check whether my machine has internet access or not

How can I programmatically check whether my machine has internet access or not using C/C++, is it just a matter of pinging an IP? How does NIC do it ? I mean something like: enter image description here

I am using Windows 7.


Source: (StackOverflow)

Advertisements

ixgbe: setting the number of RX/TX queues

I want to set the number of RX/TX queues used by an Intel 10G NIC. Let me explain why:

I am using an Intel 10G NIC of type X520, on a Dell R720 system. I am using ixgbe version 3.6.7-k. The kernel in Ubuntu 3.2.0-59.

I am running my network application on 4 out of the 24 cores on the machine. Currently the NIC is using flow-director so I've got 24 TX and RX queues, while most of the IRQs finally run on the 4 cores running the application.

However, I see that some IRQs are running on the other 20 queues (this is probably happening as flow-director samples about 20% of the traffic so some traffic goes through regular RSS). Now I don't want any IRQ to be run on the other 20 cores as they are doing a different task which is damaged by the IRQs running.

I tried setting the affinity of the interrupts only to the 4 cores I use, but this does not work well with flow-director. I guess a better approach will be using only 4 RX/TX queues and assigning them to the dedicated cores. But I couldn't find a way to set the number of RX/TX queue in the ixgbe driver (though this is quite simple with other 10G drivers I am familiar with, such as Broadcom's bnx2x).

Any idea?


Source: (StackOverflow)

elasticsearch multiple nic bind network interfaces

introduction

when configuring elasticsearch I ran into a problem with binding the listening interfaces. somehow the documentation does not provide how to setup multiple network interfaces (network def and bind def)

problem description

my intention is to setup the network.bind_host as _eth1:ipv4_ and _local_

even when trying to setup the bind_host as _local_ only, the elastic search port 9200 is still only reachable by eth1 (of course i have restarted the server)

solutions tried

i have tested the firewall configuration by setting up a netcat server and this one works perfectly for that port

so this results in 2 Questions:

  1. how to configure multiple nics? (whats the notation?)
  2. would i require to change the network.publish_host ?!

.

  • any other pointers?

current configuration:

network.bind_host:    _eth1:ipv4_
network.publish_host: _eth1:ipv4_
network.host:         _eth1:ipv4_

also tested configuration:

network.bind_host:    _local_
network.publish_host: _eth1:ipv4_
network.host:         _local_

PS: afaik the publish_host is the nic for the inter-server communication


Source: (StackOverflow)

How to get nic card name

Anybody knows how to get nic card name

when I do ipconfig/all I can get this

Ethernet adapter XC99HT:

   Connection-specific DNS Suffix  . : xx.xx.com
   Description . . . . . . . . . . . : HP NC382i DP Multifunction Gigabit Server
 Adapter
   Physical Address. . . . . . . . . : F4-CE-46-94-E8-B0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 177.77.153.48(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 177.77.153.1
   DNS Servers . . . . . . . . . . . : 177.77.124.129
                                       177.77.124.130
   Primary WINS Server . . . . . . . : 177.77.124.129
   Secondary WINS Server . . . . . . : 177.77.124.130
   NetBIOS over Tcpip. . . . . . . . : Enabled

would like to get "HP NC382i DP Multifunction Gigabit Server Adapter" just by using/passing the Ethernet name "XC99HT"


Source: (StackOverflow)

Assigning a public ip address to an existing nic in Azure using powershell

Using Azure CLI, it's possible to create and assign a public ip address to an existing nic e.g.

Create a public ip in a given resource group and region

azure network public-ip create -g myresourcegroup -a Dynamic -l westus mypublicipname

Assign the pip created in previous step to an existing nic

azure network nic set -g myresourcegroup -p mypublicipname mynicname

However similar code in powershell doesn't work e.g.

Create a new pip (completes successfully)

$pip = New-AzureRmPublicIpAddress -Name $pipName -ResourceGroupName $rgName -Location $locName -AllocationMethod Dynamic -Force

Assign to an existing nic

$nic = Get-AzureRmNetworkInterface -ResourceGroupName $rgName -Name $nicName
$nic.IpConfigurations[0].PublicIpAddress = $pip.IpAddress

Last line doesn't work and throws the following error:

The property 'Id' cannot be found on this object. Verify that the property exists and can be set.
At line:31 char:9
+         $nic.IpConfigurations[0].PublicIpAddress.Id = $pip.Id
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Though intellisense in PS ISE does show Id property for both! Does anyone knows if this is supposed to work?


Source: (StackOverflow)

How to give highest priority to ethernet interrupt in linux

I listed all interrupts with this:

cat /proc/interruts

it gives this:

        CPU0        CPU1         CPU2        CPU3
    0:   126           0            0           0     IO-APIC-edge        timer
    1:   941           0            0           0     IO-APIC-edge        keyboard
    ... (etc.)
   19:   941           0            0           0     IO-APIC-fasteoi      eth0
    ... (etc.)

Does the first column in this table give priority level of interrupts? I just want to learn priority levels, because I want to increase my NIC's interrupt priority level for better network performance. I think, first two interrupts cannot be changed (I guess due to intel x86 architecture).

Anyway, here is my question:

Is it possible to increase priority level of my NIC's interrupts?


Source: (StackOverflow)

Script to change Small RX Buffers in the Advanced Properties of the NIC

We are experiencing packet loss on our SQL 2012 Always On Windows Clusters running in our virtual environment.
Through our troubleshooting we have found that we need to increase the Small RX buffers on our SQL 2012 Always On Clusters from the default of 1024 to 8192. (reference link below)

I can do this in the GUI all day, but there are several 2012 Always On setups running in our environment where this setting needs to be changed.

I've followed the reference below and I'm not finding the setting changes reflected in the registry (even after reboot) so I can reference the key to change.

Note: I am running on Windows Server 2008 R2 with Clustering (wishing I was on Windows Server 2012 with the new PowerShell Commands).

I'm looking for the right place to update this setting, the method can be just about anything other than clicking through the GUI (I have the Steps for the GUI in the Reference below).

Is there a way I can update the Small Rx Buffers via script on Windows Server 2008 R2?

Reference: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2039495


Source: (StackOverflow)

Netmap/PF_RING and TCP Segmentation Offload and Large Receive Offload

In a custom user space networking stack, backed by Netmap or PF_RING, is the ability to use TCP Segmentation Offload and/or Large Receive Offload lost?

The only place I can find anything that mentions NIC offloading w.r.t. Netmap or PF_RING is in Netmap: a novel framework for fast packet I/O, but it isn't apparent to me if it's usable or if it's operating transparently in the NIC:

Popular hardware features related to TCP acceleration, such as hardware checksumming or even encryption, Tx Segmentation Offloading, Large Receive Offloading, are completely orthogonal to our proposal: they reduce some processing in the host stack but do not address the communication with the device.

Thank you for your time and happy holidays!


Source: (StackOverflow)

Assigning IP from Batch Script

With the below code I am getting an error "Invalid interface LAN: specified". This code works in Win7, however, does NOT working in windows XP. I suspect it has something to do with the "!adapterName!" conflicting within XP.

I utilize this script to obtain the NIC Name in case it changes in the future some how and would like to keep this scheme. Any ideas how I can continue with such script in an XP environment?

    :: Set primary and alternate DNS for IPv4
@ECHO OFF
for /f "tokens=* delims=0" %%a in ("%SITEID%") DO set DROPZERO=%%a
SETLOCAL EnableDelayedExpansion

SET adapterName=

FOR /F "tokens=* delims=:" %%a IN ('IPCONFIG ^| FIND /I "ETHERNET ADAPTER"') DO SET adapterName=%%a

REM Removes "Ethernet adapter" from the front of the adapter name
SET adapterName=!adapterName:~17!
REM Removes the colon from the end of the adapter name
SET adapterName=!adapterName:~0,-1!

echo Setting Static IP Information... 
set IP_Addr=10.102.%DROPZERO%.105
set D_Gate=10.102.%DROPZERO%.1
set Sub_Mask=255.255.255.0
netsh interface ip set address "!adapterName!" static %IP_Addr% %Sub_Mask% %D_Gate% 1 > output_net.txt
netsh interface ip set dns name="!adapterName!" static 10.98.1.26 primary >> output_net.txt
netsh interface ip add dns name="!adapterName!" 10.98.1.48 index=2 >> output_net.txt

Source: (StackOverflow)

bind/connect to network interface card using python

I am trying to connect/bind to a specific Network Interface Card (NIC) or wireless network interface. For instance, when I create a socket, I want to connect using the name of the network (such as 'wlan0' or 'eth0') instead of using the IP address. In JAVA I can do this easily with the following code:

//Initializing command socket

//String networkCard = "wlan0"; //or could be "eth0", etc.

NetworkInterface nif = NetworkInterface.getByName(networkCard);

Enumeration<InetAddress> nifAddresses = nif.getInetAddresses();

// IP address of robot connected to NIC       
SocketAddress sockaddr = new InetSocketAddress("192.168.1.100", 80);

sock = new Socket();

// bind to the specific NIC card which is connected to a specific robot

sock.bind(new InetSocketAddress(nifAddresses.nextElement(), 0));

sock.connect(sockaddr,10000);

I want to translate this to Python, but I am having a hard time. Any suggestions on how to do this?

I was using sockopt and the AF_CAN, but nothing is working.

Thank you very much!!!


Source: (StackOverflow)

Can I select what Ethernet port I use for UDP communication?

I am writing code that will communicate to a network via UDP. From the udp documentation, all I have to do is specify a destination address and port and I can start sending/receiving data.

I have two separate Ethernet ports (and potentially a USB-to-RJ45 adapter) that I want to be able to communicate on. The documentation doesn't specify if there's a way to select what NIC card my data should be output on; is it possible to specify? My users will likely be connected to the Internet with their main Ethernet port, then using my code to do communication with the second port (or USB-to-RJ45). (These are two separate networks.)


Source: (StackOverflow)

How to view vendor information of my NIC?

How to get the vendor information of my NIC on top of Ubuntu? I wanna get its vendor, type and things like that? Any shell commands available? Thanks in advance.


Source: (StackOverflow)

Is that possible to add two different default gateways into the routing table for two different NICs in android?

By default, the packets of default connection will use eth0 to go out/in. The default gateway in the routing table is eth0's gw ip.

When another interface said eth1 is up, I want to add another default gateway for eth1. Is that possible in android? Since I cannot add another default gateway for eth1 because there already exists eth0's.

Thanks for your help.


Source: (StackOverflow)

What does the meaning of "[fixed]" string in output of ethtool command

I run ethtool to query the offload features of a NIC using "ethtool -k" command, and the output is something as follows:

ethtool -k eth0

scatter-gather: on
tx-scatter-gather: on
tx-scatter-gather-fraglist: off **[fixed]**

I am wondering what the meaning of "[fixed]" is.


Source: (StackOverflow)