Yocto recipe set hostname on raspberry - raspberry-pi

How can I set a hostname with Yocto recipe for raspberry pi 4?
I'am trying to set up a personalized hostname and hosts files on yocto raspberry image but I don't know how to do it.
Here is my file's examples.
"hosts"
pi#raspberrypi:/etc $ sudo vim hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 my_personalized_hostname
and hostname
hostname
Any helps? thanks.

Set hostname_pn-base-files = "your_hostname" in local.conf.

Related

How to Open Port 1433 on Raspberry Pi?

I have tried to connect to MSSQl Database from raspberry pi. However, I have a few errors coming. I try to telnet the server ip address like that.
telnet 192.168.10.70 1433
Trying 192.168.10.70
Connected to 192.168.10.70
Escape character is '^]'
However,to check if a server has port 1433 listening, I run netstat -ano -p |find “1433” in command prompt but the error is No such file or directory.
So I think running the netstat command on Pi returns no result because there is no port 1433 open on Pi, not server. So anyone knows how to open the port in Pi?
I have used ufw but after it is enabled, I cannot ssh. Do we really need ufw? That's the part I am confusing.

Cant set up a bridge between BATMAN-adv mesh network and pc

I am trying to set up a bridge between my BATMAN-adv mesh network running on Raspi4's and my pc.
Ive tried a couple of different tutorials but all of them result in the same end result, no working bridge.
I cant find the problem with how i set it up.
This is the script i use to configure the mesh network:
bash service wpa_supplicant stop sudo systemctl mask wpa_supplicant.service sudo update-rc.d dhcpcd disable
ip link set wlan0 down #e.g. <if> = wlan0
iw wlan0 set type ibss
ifconfig wlan0 mtu 1500 # This is necessary for batman-adv
iwconfig wlan0 channel 3
ip link set wlan0 up
iw wlan0 ibss join swarmbots 2432 # e.g. <ssid> = my-mesh-network
#Frequency is 2.432. 0.0x should match with channel.
modprobe batman-adv
batctl if add wlan0 # e.g. <if> = wlan0
ip link set up dev wlan0
ip link set up dev bat0
sudo batctl gw_mode client
I found a couple of different ways to set up a bridge, listed here:
These would be executed after i configured the device on the mesh network
sudo batctl gw_mode server
ip link add name mesh-bridge type bridge
ip link set dev eth0 master mesh-bridge
ip link set dev bat0 master mesh-bridge
ip link set up dev eth0
ip link set up dev bat0
ip link set up dev mesh-bridge
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o bat0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i bat0 -o eth0 -j ACCEPT
sudo batctl gw_mode server
And the 3th try:
sudo batctl gw_mode server
sudo brctl addbr br0
sudo brctl addif eth0
sudo brctl addif bat0
Anybody able to help me out?
Thanks

Add Additional Ips to my new Dedicated Server

I'am not really into Commands and Dedciated server but i had to buy one recently with 5 usuable Ips and got the informations Bellow :
Usable IP Range: 142.54.190.234 - 142.54.190.238
Gateway: 142.54.190.233
Subnet Mask:255.255.255.248
How can add those Ips to the Main one via SSH ?? since i can connect to only the first one which is 142.54.190.234 knowing that im planing to Install Powermta on that server Btw the machine is runing centos 6
Assuming your default interface is eth0 then you'll be able to add the other ip address as aliases to the default interface (eth0) or whatever interface name you have there.
ifconfig eth0:0 142.54.190.235 netmask 255.255.255.248
ifconfig eth0:1 142.54.190.236 netmask 255.255.255.248
ifconfig eth0:2 142.54.190.237 netmask 255.255.255.248
ifconfig eth0:3 142.54.190.238 netmask 255.255.255.248
If you can add these in /etc/rc.local at the end just to be sure that in case of a restart/reboot of the server, these ips are added after boot.
There are other methods as well but this would be the easiest one and it does exactly what you need.

How does one service resolve the address of another service using docker compose, link hostname, and ports?

I have read several SO questions revolving the same question, but due to insufficient points, I cannot comment on existing questions. Therefore, I must spawn my own question thread regarding docker-compose and links.
I was under the impression that having the following in a docker-compose file would add 'db' to my container's hostfile
web:
links:
- db
I was thinking that my web code could establish a db connection with something along the lines of
db := sql.Open("postgres", "user=foo dbname=baz host=db")
where hostname db exists in my web container's /etc/hostfile and therefore resolves to some address that reaches the db container.
My web application does not resolve to the address where my db is running, instead it resolves to an address (172.19.0.3) and I cannot figure out where it has come from or how to fix.
docker exec $WEB_CONTAINER_ID cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.19.0.2 6f52f9e78f00
I was expecting to see an entry for db. Furthermore:
docker exec $WEB_CONTAINER_ID nslookup db
Name: db
Address 1: 172.19.0.3 apiserver_postgres_1.apiserver_default
What am I misunderstanding? How do I enable my web code to resolve my db address?
This is no longer your classic docker 1.8 or less "link", especially if you are using version 2 of docker-compose.yml file.
As mentioned in issue 3002:
version:"2" creates a bridge network by default for your project. If you run docker network ls you'll see a new bridged network where your project containers will be created. (which makes totally sense)
Docker itself has removed these variables from links on any network except for the old bridge network.
There is now an embedded DNS.

Why my postgresql do not find my host [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
My server is Debian 7 and I use PostgreSQL 9.3.
This is my hosts file:
root#localhost:/etc# cat hosts
127.0.0.1 localhost.localdomian localhost
127.0.1.1 virtualserver.com virtualserver
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
And when I want to startup a new console of psql:
root#localhost:/var/lib/postgresql/9.3/main# service postgresql restart
[ ok ] Restarting PostgreSQL 9.3 database server: main.
root#localhost:/var/lib/postgresql/9.3/main# sudo -u postgres psql
sudo: unable to resolve host localhost.localdomain
psql (9.3.0)
Type "help" for help.
You can see that the the machine can not find the localhsot.localdomain. But I changed the root files, and make it as correct in my /etc/hosts files and reboot it already.
Your /etc/hosts has a typo, it should be:
127.0.0.1 localhost.localdomain localhost
127.0.1.1 virtualserver.com virtualserver
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
localdomain was spelled localdomIAn.