What would be a causing no response from ESP-01 when using AT commands from Raspberry Pi Pico - esp8266

I have a Raspberry Pi Pico and I'm trying to get it Wifi Connected.
I'm using an ESP-01 with the sock firmware and confirmed AT commands are working through the Arduino serial monitor on both 115200 and 9600 Baud. To connect to my PC I am using an ESP-01S USB adapter I've gotten on amazon.
AT
OK
AT+GMR
AT version:1.2.0.0(Jul 1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
v1.0.0
Mar 11 2018 18:27:31
OK
+--------------------------+
| Both NL & CR | 9600 Baud |
+--------------------------+
Once I get everything wired up to the Raspberry Pi Pico there is now a blue light on the ESP-01, which wasn't on with the USB serial adapter. And I do not get a response from the ESP-01.
+-------------------+ +-------------------+
| | 3.3v PS | |
| Raspberry Pi | = | | ESP-01 |
| Pico | | +------+ 3.3v |
| | | | |
| GPIO 0 +----------------> RXD |
| | | | |
| GPIO 1 <----------------+ TXD |
| | | | |
| GND +-------+--------+ GND |
| | | |
| | | |
+-------------------+ +-------------------+
from machine import UART
uart = UART(0, baudrate=9600)
def write(msg):
print("Sending %s" % msg)
uart.write(msg)
write('AT\r\n')
while True:
if t:
print(t)
else:
t = uart.readline()
print('.', end="")
Tried with multiple baudrates as well as UART 0 and UART 1 (TX=0, RX=1 and TX=4, RX=5).
ESP-01 is supplied with 3.3v and not using power from the Raspberry Pi.
What could be going on that would prevent a response?

Related

Is there a way to relay veth in docker to remote host by tunnel?

I do not want the docker to access my host LAN or internet directly by NAT.
Is it possible to provide a tcp or udp tunnel to relay the veth in docker to the remote proxy? So that the docker can not access my local network resource and can use the remote host to access internet (just like a proxy).
+-------------------+
| lan 10.1.2.3/24 | +-------------+
+------>+-------tunnel- ----|<----->+ remote host |
| +-------------------+ +-------------+
|
+-------+-------+
| veth01-peer |
+-------+-------+
|
+-----------+------------+
| | veth01 | |
| | 192.168.1.100 | |
| +------------------+ |
| docker |
+------------------------+

physical address space mapping for arm64

I found physical address space mapping for Arm from DEN0001C_principles_of_arm_memory_maps.pdf:
32-bit, 36-bit and 40-bit ARM Address Maps
Address map in use in ARM development systems today
- 32-bit - - 36-bit - - 40-bit -
1024GB+ + +--------------+ <- 40-bit
| | DRAM |
~ ~ ~ ~
| | |
| | |
| | |
| | |
544GB + + +--------------+
| | Hole or DRAM |
| | |
512GB + + +--------------+
| | Mapped |
| | I/O |
~ ~ ~ ~
| | |
256GB + + +--------------+
| | Reserved |
~ ~ ~ ~
| | |
64GB + +--------------+--------------+ <- 36-bit
| | DRAM |
~ ~ ~ ~
| | |
| | |
34GB + +--------------+--------------+
| | Hole or DRAM |
32GB + +--------------+--------------+
| | Mapped I/O |
~ ~ ~ ~
| | |
16GB + +--------------+--------------+
| | Reserved |
~ ~ ~ ~
4GB +--------------+--------------+--------------+ <- 32-bit
| 2GB of DRAM |
| |
2GB +--------------+--------------+--------------+
| Mapped I/O |
1GB +--------------+--------------+--------------+
| ROM & RAM & I/O |
0GB +--------------+--------------+--------------+ 0
- 32-bit - - 36-bit - - 40-bit -
Figure 1 32-bit, 36-bit and 40-bit Address Map
But I cannot find any mapping of arm64, is there any official doc?
update
The Arm architecture does not standardize the CPU’s view of the physical address space indeed, DRAM may start at address 0x0, but often it does not. SoC designers can decide their AXI address space layout.
=============================================================
32-bit armv7 without LPAE can access up to 32-bit address space
32-bit armv7 can access up to 40-bit address space
64-bit arm can naturally access up to 48-bits of physical address space:
256TB +-----------------+ <- 48-bit
| DRAM |
~ ~
| |
| |
| |
| |
136TB +-----------------+
| Hole or DRAM |
| |
128TB +-----------------+
| Mapped |
| I/O |
~ ~
| |
64TB +-----------------+
| Reserved |
~ ~
| |
16TB +-----------------+ <- 44-bit
~ ~
~ ~
~ ~
0GB +-----------------+ 0
So, the address space below 48bits just follows the layout in the question description.

Docker Swarm: bypass load balancer and make direct request to specific containers

I have two containers running in a swarm. Each exposes a /stats endpoint which I am trying to scrape.
However, using the swarm port obviously results in the queries being load balanced and therefore the stats are all intermingled:
+--------------------------------------------------+
| Server |
| +-------------+ +-------------+ |
| | | | | |
| | Container A | | Container B | |
| | | | | |
| +-------------+ +-------------+ |
| \ / |
| \ / |
| +--------------+ |
| | | |
| | Swarm Router | |
| | | |
| +--------------+ |
| v |
+-------------------------|------------------------+
|
A Stats
B Stats
A Stats
B Stats
|
v
I want to keep the load balancer for application requests, but also need a direct way to make requests to each container to scrape the stats.
+--------------------------------------------------+
| Server |
| +-------------+ +-------------+ |
| | | | | |
| | Container A | | Container B | |
| | | | | |
| +-------------+ +-------------+ |
| | \ / | |
| | \ / | |
| | +--------------+ | |
| | | | | |
| | | Swarm Router | | |
| v | | v |
| | +--------------+ | |
| | | | |
+--------|----------------|----------------|-------+
| | |
A Stats | B Stats
A Stats Normal Traffic B Stats
A Stats | B Stats
| | |
| | |
v | v
A dynamic solution would be ideal, but since I don't intend to do any dynamic scaling something like hardcoded ports for each container would be fine:
::8080 Both containers via load balancer
::8081 Direct access to container A
::8082 Direct access to container B
Can this be done with swarm?
From inside an overlay network you can get IP-addresses of all replicas with tasks.<service_name> DNS query:
; <<>> DiG 9.11.5-P4-5.1+deb10u5-Debian <<>> -tA tasks.foo_test
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19860
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;tasks.foo_test. IN A
;; ANSWER SECTION:
tasks.foo_test. 600 IN A 10.0.1.3
tasks.foo_test. 600 IN A 10.0.1.5
tasks.foo_test. 600 IN A 10.0.1.6
This is mentioned in the documentation.
Also, if you use Prometheus to scrape those endpoints for metrics, you can combine the above with dns_sd_configs to set the targets to scrape (here is an article how). This is easy to get running but somewhat limited in features (especially in large environments).
A more advanced way to achieve the same is to use dockerswarm_sd_config (docs, example configuration). This way the list of endpoints will be gathered by querying Docker daemon, along with some useful labels (i.e. node name, service name, custom labels).
While less than ideal, you can introduce a microservice that acts as an intermediary to the other containers that are exposing /stats. This microservice would have to be configured with the individual endpoints and operate in the same network as said endpoints.
This doesn't bypass the load balancer, but instead makes it so it does not matter.
The intermediary could roll-up the information or you could make it more sophisticated by passing a list of opaque identifiers which the caller can then use to individually query the intermediary.
It is slightly "anti-pattern" in the sense that you have a highly coupled "stats" proxy that must be configured to be able to hit each endpoint.
That said, it is good in the sense that you don't have to expose individual containers outside of the proxy. From a security perspective, this may be better because you're not leaking additional information out of your swarm.
You can try to publish a specific container port on a host machine
,add to your services:
ports:
- target: 8081
published: 8081
protocol: tcp
mode: host

How do I create a docker container with two network interfaces but on the same network

I need to reproduce a scenario where there are two machines on a network. Machine 1 has two network interfaces (say for control and data traffic), both on the same network.
------------- -------------
| M 1 | | M 2 |
| eth0 eth1 | | eth0 |
1.1.1.1 1.1.1.2 | 1.1.1.3 |
| | | | | | |
------------- -------------
| | |
+------+--network 1.1.1.0/24----+
I see there are solutions to have two networks on a docker container, but is it possible to have two interfaces on the same network in docker?

Forward SSH connections based on user name

I found numerous sites explaining ssh port forwarding, ssh reverse proxy, ssh multiplexing etc. involving sshpiper, sslh, running a ssh socks server, just configuring the local SSH server an so on..
so I'm quite puzzled right now and might ask a very common and/or simple question:
As you might already guess from the title I want to set up a git server (GitLab) inside a docker container listening for SSH connections on port 22 without having to use a different port for default ssh operations (terminal, scp, etc..) on the host (as suggested here)
I.e.
ssh alice#myserver.org should still be possible as well as
git clone git#myserver.com:path/to/project
and I don't want to do any setup on the client computer
If you prefer a picture:
+------ myserver.org --------+
| +----+ +- typical -+ |
+--------+ alice#myserver.org:22 | | | | SSH | |
| client | ----------------------> -+--+----+---->| service | |
+--------+ all names but `git` | | ? | +-----------+ |
| | | |
| | ? | +- docker --+ |
+--------+ git#myserver.org:22 | | | | with | |
| client | ----------------------> -+--+----+---->| GitLab | |
+--------+ only user `git` | | | | | |
| +----+ +-----------+ |
+----------------------------+
Can you tell me what's the recommended/most common way to do this? This question sounds promising but the answer seems to configure the client (which I want to avoid)
This project may help you.
https://github.com/tg123/sshpiper.
SSH Piper works as a proxy-like ware, and route connections by username, src ip , etc.
+---------+ +------------------+ +-----------------+
| | | | | |
| Bob +----ssh -l bob----+ | SSH Piper +-------------> Bob' machine |
| | | | | | | |
+---------+ | | | | +-----------------+
+---> pipe-by-name--+ |
+---------+ | | | | +-----------------+
| | | | | | | |
| Alice +----ssh -l alice--+ | +-------------> Alice' machine |
| | | | | |
+---------+ +------------------+ +-----------------+
Downstream SSH Piper Upstream
First of all, thanks for reading TheDockerExperts blog , hope our articles help you! Let me explain how we do SSH proxy in our company.
We have HAproxy that listens TCP 22 port and sends traffic to GitLab server, on host we have custom SSH port. Unfortunately as we use TCP balancing in this case, there is no way to create balancer based on domain names and users. You can take small VPS , spin up HAproxy on it and use it to balance your GIT traffic.
Hope this will help you!

Resources