Udhcpd read /etc/hosts like dns - nginx

I'm building a hotspot with udhcpd and nginx (Linux raspbian, 4.9.41-v7+, armv71). It's working very well, but i want that user enter "home" instead "192.168.2.1" on browser to access my portal.
I set-up the following configurations:
/etc/hosts
127.0.0.1 localhost
127.0.1.1 rpi
192.168.2.1 home
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
and /etc/udhcpd.conf
start 192.168.2.10
end 192.168.2.254
interface wlan0
opt dns 192.168.2.1 8.8.8.8 8.8.4.4
opt subnet 255.255.255.0
opt router 192.168.2.1
opt hostname rpi
but, when i try access "home/" or "rpi/" the following error appears:
Isn't possible to find "home" on DNS server.
ERR_NAME_NOT_RESOLVED
Client config after dhcp ack:
Connected to WiFi SSID: rpi
IP: 192.168.2.76
Any suggestions?
grateful for help.

udhcpd hasn't a build-in dns server. I just switch to dnsmasq and it worked!

Related

"Host key verification failed" error when running mpiexec within a cluster

I'm trying to create an mpi cluster by connecting two laptops and running mpi programs. I followed the steps as mentioned here (https://medium.com/mpi-cluster-setup/mpi-clusters-within-a-lan-77168e0191b1). I am able to ssh to the other nodes without a password. However when I try to run mpiexec -n 2 -hosts manager,worker ./main I get this following error.
[proxy:0:1#gunavaran-HP-Pavilion-Notebook] HYDU_sock_connect (utils/sock/sock.c:113): unable to get host address for gunavaran-HP-ENVY-15-Notebook-PC
[proxy:0:1#gunavaran-HP-Pavilion-Notebook] main (pm/pmiserv/pmip.c:181): unable to connect to server gunavaran-HP-ENVY-15-Notebook-PC at port 43211 (check for firewalls!)
Host key verification failed.
This is my hostfile
127.0.0.1 localhost
#127.0.1.1 gunavaran-HP-ENVY-15-Notebook-PC
#MPI SETUP
192.168.8.102 manager
192.168.8.108 worker
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
I changed the hostnames to manager and worker using sudo hostnamectl set-hostname. It works fine now.

BeagleBone Black cant connect to internet via Ethernet cable

I cant seem to connect to the internet with my beaglebone black (Debian 10 buster) via a ethernet cable which is connected to my laptop.
It was working yesterday but for some reason it decided to just stop working. Here is my putty setup:
When i try to ping 8.8.8.8 i receive the following error:
debian#beaglebone:/var/lib/cloud9$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 169.254.193.76 icmp_seq=1 Destination Host Unreachable
From 169.254.193.76 icmp_seq=2 Destination Host Unreachable
From 169.254.193.76 icmp_seq=3 Destination Host Unreachable
From 169.254.193.76 icmp_seq=4 Destination Host Unreachable
I tried setting a static ip for the beaglebone black by adding the following to /etc/network/interfaces:
iface eth0 inet static
address 192.168.1.102
netmask 255.255.255.0
gateway 192.168.1.254
dns-nameservers 8.8.8.8
dns-nameservers 8.8.4.4
But still no luck.
Does anybody know how i can fix my network issue? Thank you.

Need to Bridge Network Port from local machine to Vagrant VM

On my development machine, I can see the following DHCP traffic on eth1 port:
sudo tcpdump -i eth1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
09:51:58.785056 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP,
Request from 00:06:31:c7:1e:23 (oui Unknown), length 315
09:51:58.785384 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP,
Request from 00:06:31:c7:1e:23 (oui Unknown), length 315
09:51:59.786677 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP,
Request from 00:06:31:c7:1e:23 (oui Unknown), length 315
I want to see this same traffic in my Vagrant VM. So I want to bridge the eth1 port on my development machine to some port on my Vagrant VM. I also want to be able to send network traffic from my Vagrant VM back onto the eth1.
Using the answer in the following question:
https://superuser.com/questions/752954/need-to-do-bridged-adapter-only-in-vagrant-no-nat
I added this to my Vagrantfile:
config.vm.provision "shell",
run: "always",
inline: "route -A inet6 add deault gw fc00::1 eth1"
But I don't really know what this does, except that it seems to only route ipv6 traffic? Could someone help explain how to bridge eth1 to a port on my Vagrant VM?
I also tried the following in my Vagrantfile:
Vagrant::Config.run do |config|
config.vm.network :bridged
end
yet after I do vagrant up again, I still don't see any port (using ifconfig) in my VM that has the DHCP traffic.
After reading up on Vagrant, I found a solution that worked for me.
Firstly, I ran the following command on my host machine:
sudo ip route add 192.168.1.0/24 dev eth1
My understanding is that this routes traffic from eth1 physical port to 192.168.1.0 IP address.
Then, in my Vagrantfile I added the following under Vagrant.configure(2) do |config|:
config.vm.network “public_network”, bridge: “eth1”
config.vm.network “public_network”, ip: “192.168.1.0”
After doing vagrant destroy and vagrant up, I now see a new port in my vagrant VM (enp0s8), that if I do tcpdump on I see the DHCP traffic (and other traffic) that is arriving on my eth1 port on my host machine.
Not sure if this is the best solution, as I am still very new to vagrant and VirtualBox, but this worked for me.

How to configure firewall on Centos 7 for KVM Routed Bridge

I want to set up multiple virtual machines to run webserver, postfix, etc.
I have a few public IP-Adresses from my ISP. My host system is running Centos 7 and my virtual machines are running Debian Wheezy. Since my hoster restrict access to the switch based on MAC Address, I cannot use a "full" bridge.
Instead I configured a routed bridge (see http://wiki.hetzner.de/index.php/Proxmox_VE)
I have successfully set up both machines, but the vm cannot connect to the internet if my firewall on my host machine is active. If my firewall is active I can ping machines on the internet from my vm, but nothing else.
How can I configure my firewall under Centos 7 to give the VMs on br0 acces to internet?
Any help is appreciated. Thank you very much.
Network Config Host Machine
Host-Machine: /etc/sysconfig/network-scripts/ifcfg-enp2s0
BOOTPROTO=none
DEVICE=enp2s0
ONBOOT=yes
IPADDR=A.A.A.42
NETMASK=255.255.255.255
SCOPE="peer A.A.A.1"
Host-Machine: /etc/sysconfig/network-scripts/route-enp2s0
ADDRESS0=0.0.0.0
NETMASK0=0.0.0.0
GATEWAY0=A.A.A.1
Host-Machine: /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE="Bridge"
ONBOOT=yes
BOOTPROTO=none
IPADDR=A.A.A.42
NETMASK=255.255.255.255
STP=off
DELAY=0
Host Machine: /etc/sysconfig/network-scripts/route-br0
ADDRESS0=B.B.B.160
NETMASK0=255.255.255.255
Network Config Virtual machine
Virtual machine: /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address B.B.B.160
netmask 255.255.255.255
pointopoint A.A.A.42
gateway A.A.A.42
Firewall settings Host machine
firewall-cmd --list-all
public (default, active)
interfaces: br0 enp2s0
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
Thank you very much in advance.
To accomplish, you have two options.
Option1:(from a security perspective this method is recommended)
Disable netfilter on the configured bridge
# vi /etc/sysctl.conf
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
Check the values before/after.
# sysctl -p /etc/sysctl.conf
Option2:
Add direct firewall rule
firewall-cmd --direct --add-chain ipv4 filter FORWARD 0 -m physdev --physdev-is-bridged -j ACCEPT
On CentOS 8 (and probably CentOS 7) with firewalld, there's a much easier way to get all routed bridged KVM virtual machines full unrestricted internet access without dealing with firewall rules.
By default, all interfaces are bound to the public firewall zone.
But there are multiple zones, ie firewall-cmd --list-all-zones of which one is called trusted, which is an unfiltered firewall zone that accepts all packets by default.
So you can just bind the bridge interface to that zone.
firewall-cmd --remove-interface br0 --zone=public --permanent
firewall-cmd --add-interface br0 --zone=trusted --permanent
firewall-cmd --reload
Hope this helps.

What should be the host file configuration for Cloudera Installation for 5 nodes?

I am trying to install Cloudera cluster on 5 machines- 4 as ubuntu 12.04 and 1 as Oracle Enterprise Linux 5.8.
I have run the Cloudera Manager Installer on Oracle Linux Enterprise host which should act as a name node ( with ip address 192.168.1.185) and other 4 Ubuntu hosts should act as data nodes.
I have completed all the prerequisites and I have configured host files as:
For Ubuntu:
127.0.0.1 localhost
192.168.1.181 hduser1.example.co.in hduser1
192.168.1.182 hduser2.example.co.in hduser2
192.168.1.183 hduser3.example.co.in hduser3
192.168.1.184 hduser4.example.co.in hduser4
192.168.1.185 hduser5.example.co.in hduser5
#The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
For Oracle Enterprise Linux:
192.168.1.181 hduser1.example.co.in hduser1
192.168.1.182 hduser2.example.co.in hduser2
192.168.1.183 hduser3.example.co.in hduser3
192.168.1.184 hduser4.example.co.in hduser4
192.168.1.185 hduser5.example.co.in hduser5
127.0.0.1 hduser5.example.co.in hduser5 localhost.localdomain loca$
::1 localhost6.localdomain6 localhost6
I am not sure whether this configuration is correct as i have got errors related to reverse DNS as follows:
The following failures were observed in checking hostnames. Showing first 1000 failures only...
DNS reverse lookup of IP 192.168.1.184 on host hduser1.example.co.in failed. Expected hduser4.example.co.in but got hduser4.local.
DNS reverse lookup of IP 192.168.1.182 on host hduser1.example.co.in failed. Expected hduser2.example.co.in but got hduser-desktop-3.local.
DNS reverse lookup of IP 192.168.1.183 on host hduser1.example.co.in failed. Expected hduser3.example.co.in but got hduser-desktop.local.
After a long research I found that the host file configuration is correct. The problem due compatibility issues between Ubuntu and Oracle Enterprise Linux. After switching all the nodes to Ubuntu the issue was resolved.
Also I edited resolv.conf of all hosts. The configuration was as follows:
domain example.co.in
search example.co.in localdomain
nameserver 192.x.x.x

Resources