How to create a subinterface ?

May 8, 2012 at 8:41 AM

Hi

I would like to add a new interface to the router created on the tutorial.
I guess the easiest way to do so would be to create a subinterface (new IP address, netmask, etc.) and to add it to the router.

It seems rather easy but I can't get it to work :(

Has someone got a lead on how to perform this?

 

Thank you,
Nicolas

Coordinator
May 9, 2012 at 9:48 AM

Good Morning,

Are you trying to accomplish this task programatically or are you using the NetLab GUI?
What exactly are you trying to accomplish? Do you want to add a new IP address to an interface already created for the purpose of routing or do you want to add a completely new interface to your router witch has not yet been initialized?

with best regards,

Emi

May 9, 2012 at 6:06 PM
Edited May 9, 2012 at 6:08 PM

In fact, I programatically made a DHCP server using the DHCPServer class.
This server operates on a pool distributing addresses on the 192.168.11.0/24 network.
The gateway for this network is 192.168.11.1.

I linked this address to an "Ethernet" adapter like this:

if ( (ipInterface.AdapterType.ToString().Equals("Ethernet") ) && (!alreadyLinked))
                {
                    ipInterface.AddAddress(ipPool0, maskPool0);
                    alreadyLinked = true;
                }

//Then add it to the router and to our list
wpcInterfaces.Add(ipInterface);
rRouter.AddInterface(ipInterface);
dhcpServer.AddInterface(ipInterface);

 

alreadyLinked is a boolean to make sure I linked the interface to only one adapter.

The DHCP server works well but dhcp clients can't ping IP addresses outside of their dhcp scope and I can't even seen the icmp request on the pcap capture made by the TrafficAnalyser lcpDumper.

I was thinking that maybe I used the wrong way to create a subinterface.

Thank you and best regards,
Nicolas

Coordinator
May 10, 2012 at 6:44 PM

Well, this looks more like a routing or address resolution problem.

Have you set the properties ipInterface.AutoAnswerARPRequests and ipInterface.PromiscousMode to true?

In case you want to ping hosts which are not directly connected to your machine, Is a correct default route to your gateway added to your router?

Since AutoAnswerARPRequests is not set in my tutorial code, I assume this could do the trick...

May 10, 2012 at 8:32 PM
Edited May 11, 2012 at 4:58 PM

Thank you so much emi !
I set the AutoAnswerARPRequests to true and the connectivity between my two subnets is now ok !

I should have detect this on Wireshark since the client got no answer to these ARP requests.

Just one more weird thing ! I can't access to the PromiscousMode property :s
I even regenerated the eExNetworkLibrary as I saw the property in the source code of EthernetInterace class. But while exploring the dll through Visual Studio, PromiscousMode doesn't show up :(
Do you know what can be the source of this problem?

 

I will try it from my workplace station tomorrow as I've got an older version of Visual Studio there.

Edit: same thing with an older version of Visual Studio (vs 2010).

Coordinator
May 17, 2012 at 12:20 PM

This is strange, since I cannot reproduce this problem here.

Are you sure you have the last version of the NetworkLibrary added to the references of your project?
Are you inspecting the correct class (eExNetworkLibrary.EthernetInterface, not IPInterface)?

regards, Emi