Transmitting through LAN

KansaiRobot

Junior Member
May 1, 2012
21
0
61
First of all, please forgive my complete ignorance on this theme.
I would really appreciate if someone can give me some advice on this problem. any advice is appreciated.

First, the goal. I have a microcontroller (ARM Cortex A) with some interfaces I can use (USB, LAN etc). Simply put, I want to be able to transmit data through the LAN port

Until lately I didnt know anything about this but I learn quite a lot from this wonderful tutorial ::
http://beej.us/guide/bgnet/output/html/multipage/index.html

So, now I am ok with the concepts. I have been able to transmit through a "virtual LAN" using the USB port.

But how to use the real LAN port.

The manual of the equipment is of little use.

Any advice?

Thanks in advance

Kansai
 

VirtualLarry

No Lifer
Aug 25, 2001
56,554
10,171
126
You need to write:
1) An ethernet driver
2) a networking stack
and possibly
3) a TCP/IP stack to sit on top

Those things are not for noob programmers.
 

KansaiRobot

Junior Member
May 1, 2012
21
0
61
Thank you for the reply and sorry for not having clearly written my questions.

My system as it is now is working already. I have already a virtual ethernet connection working through RNDIS, so I have already programmed a program that sends and receives data to and from my microcontroller (through the USB cable)

My question was how to do the same using the LAN port.
 

KansaiRobot

Junior Member
May 1, 2012
21
0
61
Anyway, I have being reading the few documentation I got and I found that the interfaces file has the following lines:

Code:
iface eth0 inet dhcp
iface usb0 inet manual.....

Anyway, if I want to use a static address for the USB I have to modify the usb0 line to static and write the corresponding address.

And if I want to use the LAN I have to configure the eth0 line.

Now I have two questions:

1) Do these two devices (USB with RNDIS and LAN) have to have different IP adresses? or can they? I had the idea that the address was a property of the machine (in this case the microcontroller) not of the port.

2) Do the address 192.168.x.x have any special meaning. I find it a lot in the examples I review.

Thank you for the help
 

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
1) They must be different, or at least not plugged in at the same time.

2) they are private ip ranges, not on the public internet. 192.168.x.x is typically the /24 range with 254 hosts per network but that isn't required.
 

KansaiRobot

Junior Member
May 1, 2012
21
0
61
Supporting USB is a different matter than supporting Entered output.

While almost all ARM devices have support to USB ports you might notice that they usually do not support wire but rather have Wireless chip-set for WIFI.

Assuming that your device has the chipset that can support Wire Ethernet output.

Read this - http://electronics.stackexchange.co...ood-microcontroller-for-ethernet-applications




Thank you very much for your reply. I am aware that USB is quite different than LAN. I have programmed a PIC using USB in the past and it doesnt resemble what I am doing now. However, the system I am using now already runs a "virtual ethernet" over the USB so I could write a program that transmits data using just network programming. My main concern is doing the same but using the LAN port.

My device originally only supported this "virtual ethernet over USB" , but I have added an expansion board that has a LAN port. Now all I need to understand is how to configure the device file to make it run.
 

KansaiRobot

Junior Member
May 1, 2012
21
0
61
1) They must be different, or at least not plugged in at the same time.

2) they are private ip ranges, not on the public internet. 192.168.x.x is typically the /24 range with 254 hosts per network but that isn't required.

Thank you very much for your reply. :thumbsup: Very helpful.

So they have to have different addresses? can both be dynamic? or do they have to be manual?

I have to reflect on your advice and probably will come with new questions. Hope you can help me again.

Thanks again :thumbsup:
 

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
Thank you very much for your reply. :thumbsup: Very helpful.

So they have to have different addresses? can both be dynamic? or do they have to be manual?

I have to reflect on your advice and probably will come with new questions. Hope you can help me again.

Thanks again :thumbsup:

They have to have different addresses if both are going to be used at the same time. I am assuming that this device doesn't do teaming (highly unlikely with LAN + USB.) They can both be dynamic or static (manual) or a combination, it depends on your need. One static and one on dynamic is really common with those small home routers. Dynamic on the ISP side and static on the inside house side.
 

KansaiRobot

Junior Member
May 1, 2012
21
0
61
Well I have reflected on this and I have these questions.

I have this file:

Code:
auto lo usb0
iface lo inet loopback
iface eth0 inet dhcp
iface usb0 inet manual
  up ifconfig usb0 up
  post-up zcip usb0 /etc/zcip.script > /dev/null
  down ifconfig usb0 down

I understand some of it. I see that eth0 is Dynamic and the usb is manual. I dont understand the parts after that.

if the eth0 is DHCP how can I know from the other machines which address to connect?

Also is there some place where I can learn the meaning of the commands inside the file?
 

KansaiRobot

Junior Member
May 1, 2012
21
0
61
Today I experimented with the LAN port and got some results. I would really appreciate if someone can throw some light on the results (ergo comment them?)

As I said before I had a virtual ethernet through USB. I could run telnet, ftp and my own application using the hostname with this. The interfaces file was like this

Code:
auto lo usb0
iface lo inet loopback
iface eth0 inet dhcp
iface usb0 inet manual
   up ifconfig usb0 up
   post-up zcip usb0 /etc/zcip.script > /dev/null
   down ifconfig usb0 down

I modified this file to read

Code:
auto lo usb0 eth0

after this I did ifdown-a and ifup -a (without connecting the cable) and I got these error messages

Code:
>ifdown-a
ifdown: interface eth0 not configured 

>ifup -a
udhcpc started 
Sending discover
init eth0
No lease ,failing

Anyway, after this I attached the cable and tried ftp, telnet and my application in the exact same way as the USB (meaning I didnt use IP addresses, but the host name

It worked!

I typed ifconfig to check out and I could see that the eth0 has an address but the usb0 has no address and it just says UP BROADCAST RUNNING MULTICAST (in capitals)

Anyway, everything seemed fine so I disconnected the cable and connected the USB as before

however this time I couldnt connect through it! I suppose it is obvious since it has no IP address but what is worng?

in other words

Is there a way to use both the virtual ethernet (USB) and the LAN port? what kind of configuration is needed?

Thank you all for your helpful advice

Kansai
 

Enigma102083

Member
Dec 25, 2009
147
0
0
What IP address does the USB interface have? I see there that it says the LAN is set to DHCP but the USB is manual, which means it is static assigned.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |