prjemian / epics-docker

Provide EPICS IOCs in docker images
9 stars 4 forks source link

EPICS IOC name query reponds to both IP# and localhost #7

Closed prjemian closed 1 year ago

prjemian commented 5 years ago

It is observed that, on APS RHEL7 workstations, the EPICS IOC will respond through both the IP# and the localhost interfaces to a client PV name query when that client is on the same workstation as the IOC. (OTZ is host the otz: IOC and a caget otz:UPTIME request is identified by both IP# and localhost).

The docker container is started with --net=host. With this, the container's PVs can be seen by both the host as well as other workstations on the LAN. When --net=bridge, the PVs cannot be seen by the host.

What happens if the Dockerfile also exposes ports 5064 and 5065?

prjemian commented 5 years ago

Troy Lutes has suggested:

https://epics.anl.gov/base/R3-16/1-docs/CAref.html

Binding a Server to a Limited Set of Network Interfaces

The parameter EPICS_CAS_INTF_ADDR_LIST allows a ca server to bind itself to, and therefore accept messages received by, a limited set of the local host's network interfaces (each specified by its IP address). On UNIX systems type netstat -ie (same as ifconfig, type ipconfig on windows) to see a list of the local host's network interfaces. By default, the CA server is accessible from all network interfaces configured into its host.

Until R3.15.4 the CA server employed by iocCore did not implement the EPICS_CAS_INTF_ADDR_LIST feature.

Prior to R3.15.4 CA servers would build the beacon address list using EPICS_CA_ADDR_LIST if EPICS_CAS_BEACON_ADDR_LIST was no set.

prjemian commented 4 years ago

Not sure how to resolve this issue. Do not want to delay the next release for this.

prjemian commented 3 years ago

What network interfaces exist in the container?

root@mint-vm:/opt/synApps/support# cat  /etc/networks
# symbolic names for networks, see networks(5) for more information
link-local 169.254.0.0
root@mint-vm:/opt/synApps/support# nmcli
bash: nmcli: command not found
root@mint-vm:/opt/synApps/support# ifconfig
bash: ifconfig: command not found
root@mint-vm:/opt/synApps/support# ip
bash: ip: command not found
root@mint-vm:/opt/synApps/support# netstat 
bash: netstat: command not found
root@mint-vm:/opt/synApps/support# ls /sys/class/net/  
docker0  enp0s3  lo
root@mint-vm:/opt/synApps/support# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo: 3467847   41799    0    0    0     0          0         0  3467847   41799    0    0    0     0       0          0
docker0: 1623395   36380    0    0    0     0          0         0 140387727   38826    0    0    0     0       0          0
enp0s3: 655128188  454205    0    0    0     0          0         0 12950843  166833    0    0    0     0       0          0

Install more tools:

apt-get update && apt-get install -y net-tools
ipconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:eeff:fe02:f169  prefixlen 64  scopeid 0x20<link>
        ether 02:42:ee:02:f1:69  txqueuelen 0  (Ethernet)
        RX packets 36380  bytes 1623395 (1.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 38826  bytes 140387727 (140.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::4f86:a0ee:dd2c:d64f  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:49:87:91  txqueuelen 1000  (Ethernet)
        RX packets 469296  bytes 676575512 (676.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 176491  bytes 13632453 (13.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 54438  bytes 4045438 (4.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 54438  bytes 4045438 (4.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
prjemian commented 3 years ago

Looks as if enp0s3 is a common network interface that appears in the images created here. 10.0.2.15 is the IP address of one container. Can we set to the broadcast address 10.0.2.255?

prjemian commented 3 years ago

Perhaps epicsEnvSet(EPICS_CAS_INTF_ADDR_LIST, "10.0.2.255")?

prjemian commented 2 years ago

not sure this remains an issue - removing from any milestone for now

prjemian commented 1 year ago

Cannot be an issue at APS now since APS has removed the possibility of running docker containers.