• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
EtherCAT Master: any options?
#21
(April-17th-2019, 05:38 PM)Armin@netPI Wrote: Well if you read the readme of the Codesys container carefully it says using Field network communications such as Profinet or EtherCAT along with Codesys requires to start the container in “host” mode, else in “bridged” mode the container is getting a local IP address (typically 172.17.0.1...2...3) and subnet mask (255.255.0.0) by Docker and the master function can hence only be driven to this subnet (172.17.0.x) only which is not what you want. Therefore the host mode is needed letting the TCP/IP stack (and the IP setting) of the host system be shared with the container giving full access to eth0 then as if it is running on the host.

Oh yes... I have suspected that and it got lost somehow.
I discovered that DNS resolves do not work anymore. The hilschernetpi/netpi-netx-ethernet-lan/ works in host mode as expected with correct DNS. Nevertheless when I deploy the merged container on the device in host mode I get pings of IP addresses but DNS is broken. Do you came accross that already? I'm so close now...

Thank you very much for you comments and help,
Andreas
  Reply
#22
Yes indeed we had changed the Ethernet LAN container a little end of last week to simplify it, but unfortunately we have forgotten to resolve the gateway address settings. I suppose this is why your merged container does not work properly. It will be corrected tuesday next week.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#23
Hello Andreas,

I have a question concerning the hilschernetpi/netpi-netx-ethernet-lan/ source code you used for your merged container.

We have modified this container that everybody has the possibility now to choose between DHCP or static IP configuration via environment variables. So I suspect that you have maybe a new source code and have not recognized this new feature. Can you double check please?
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#24
I have investigated a little bit your DNS problem.

If you have successfully setup a cifx0 interface then calling the command

Code:
ip route show

will give you a similar output like the following

Code:
default via 172.17.0.1 dev eth0
10.11.0.0/16 dev cifx0 proto kernel scope link src 10.11.5.25
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.2

There are two networks up and running and the default route is via the docker0 bridge 172.17.0.1.

If I now remove the network cable of eth0 and call
Code:
ping google.com

then I get no response ... cause all unroutable network traffic goes through eth0 due to the default route setting ... but eth0 connection it is no more. 

If I now call

Code:
ip route delete default
ip route add default via 10.11.5.25 dev cifx0

to set the routing to the exisiting cifx0 then ping to google.com works fine as expected.

So I cannot confirm with the latest container that resolving DNS does not work.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#25
Hello Armin,

thank you for your post and help. Playing a little bit around with these things it seems to work sometimes via wifi. Sometimes it does not.
I need to further investigate and I will write here. Now I'm using the latest version of the hilschernetpi/netpi-netx-ethernet-lan/ container as a starting point.

During the process of standard gateway modifications via ip command I got also this message

Code:
sudo: unable to resolve host NetPi1

I could fix that by log in as root and run
Code:
echo 127.0.0.1 computer_name >> /etc/hosts

When I restart the NetPi and log into the container via ssh things look like this
Code:
default via 192.168.0.1 dev cifx0
default via 192.168.0.1 dev eth0 proto static metric 100
default via 10.98.44.1 dev wlan0 proto static metric 600
10.98.44.0/22 dev wlan0 proto kernel scope link src 10.98.45.128 metric 600
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.0.0/24 dev cifx0 proto kernel scope link src 192.168.0.3
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2 metric 100
With this configuration DNS does not work.
If I delete all default routes except the one for wlan0 in line 3 then it works when I have wifi connection.

Unfortunately with this configuration it does not work (Internet access through the router which has ip 192.168.0.1 and is connected to cifx0 via a switch):
Code:
default via 192.168.0.1 dev cifx0
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.0.0/24 dev cifx0 proto kernel scope link src 192.168.0.3
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2 metric 100

I'm getting closer...
Best,
Andreas
  Reply
#26
About you netPI resolve problem:

I suppose you gave your netPI "NetPi1" as Hostname in the main control panel, correct?

Instead of writing the very same Hostname manuall into the /etc/hosts/ file you can prevent this message if

a.) you set the parameter "Hostname" in the container start parameter with the same name as you used on your host
b.) create a new user-defined network that automatically embeds a DNS server for the containers using this network: https://docs.docker.com/v17.09/engine/us...igure-dns/

Regards
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#27
Quite for a time it seemed like everything is working now. But today I discovered that there is no more internet access from portainer and all containers in bridge mode. Only the container which is in host mode and controls the cifx0 interface has internet accesss.
I think I missed something. This worked already but I don't see the difference now.
  Reply
#28
Hello Andreas,

I remember that you have created container yourself with a mix of CoDeSys container and Ethernet-LAN container, is my understanding correct? What is with your Dockerfile to build your container, can you post it, so we can have a look on it.

If you say "Quite for a time it seemed like everything is working now". What does that mean? We both had the last contact 20 days ago. So what your are saying is that 20 days it worked fine and since day 21 it doesn't any more? Is my understanding correct.

What I can tell you is that containers - and this is the advantage of a container - are running always in the manner when you restart it. A big benefit. So if there is trouble today then this was also a problem in the past 20 says, but was not recognized and the "bug" was sleeping.

What does the command return?

Code:
ip route show



Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#29
Hello,

Yes that is correct, I built a container uniting the codesys and the netx containers. I use the cifx0 interface for codesys ide connection and internet connection via a router which is at 192.168.0.1.

The following configuration does not work (Internet connection inside the container (host mode) where I do the ip route show command, but no internet connection of the host system (e.g. portainer webinterface) and no connection in other bridge mode containers (e.g. node-red in bridge mode).):
Code:
pi@NetPi1:~$ ip route show
default via 192.168.0.1 dev cifx0
10.98.44.0/22 dev wlan0 proto kernel scope link src 10.98.45.128 metric 600
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.0.0/24 dev cifx0 proto kernel scope link src 192.168.0.3
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2 metric 100
 When I change the table inside the host mode containter to use only the wifi connection instead:
Code:
pi@NePi1:~$ ip route show
default via 10.98.44.1 dev wlan0 proto static metric 600
10.98.44.0/22 dev wlan0 proto kernel scope link src 10.98.45.128 metric 600
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.0.0/24 dev cifx0 proto kernel scope link src 192.168.0.3
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.2 metric 100
I do get internet connection on the host (portainer web interface) and the other containers (e.g. node-red in bridge mode).

My docker file and scripts are at github:
https://github.com/fokkersim/netPI-netx-ethernet-lan

Best regards,
Andreas
  Reply
#30
Hello Andreas,

please watch our latest edits in the current entrypoint.h https://github.com/HilscherAutomation/ne...rypoint.sh. I see you are using an older version. Pls update your container accordingly and try again.

There is a new command "ip route flush dev cifx0" implemented and very important, the line "ip link set cifx0 up" is now located right after the line "/opt/cifx/cifx0daemon",

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  NodeRed and EtherCAT Schranz 1 12 September-2nd-2019, 03:46 PM
Last Post: Armin@netPI
  EtherCAT Slave OP mode (netPI RTE3) mauroriva 1 114 June-20th-2018, 08:38 AM
Last Post: Armin@netPI
  Container IP address - Network Options kimsmyth 2 165 January-30th-2018, 11:04 AM
Last Post: kimsmyth

Forum Jump:


Users browsing this thread: 1 Guest(s)