mdnsresponder does not show the IPaddress while browsing - bonjour

I have registered a service using bonjor mdnsresponder
dns-sd -R SMARTCAM _CAMS._tcp. . 80 "u=test" "path=/pub"
When I tried to reslove by name and type as below
dns-sd -L SMARTCAM _CAMS._tcp.
I got the reply as
Lookup SMARTCAM._CAMS._tcp..local
22:16:31.777 SMARTCAM._CAMS._tcp.local. can be reached at AIR.local.:80 (interface 3)
u=test path=/pub
But here I am not getting the IP address of the PC where I registered my service (I have registered the service on IP 192.168.1.123 and hostname AIR ) .
How to get the IP address of the PC now ..? because I am running some service on that IP , I want to access them after resolving

Try to use
$dns-sd -R and dns-sd -Q
it will get you the IP address

Related

kubefwd doesn't work for specific ports/hostnames

I am using this command to run kubefwd (https://github.com/txn2/kubefwd)
sudo kubefwd services -x <context> -n <namespace> -c <kube_file_path> -l "app in (idm, sbb-amq)"
That is the log:
INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:8161 to pod sbb-amq-0:8161
INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:61616 to pod sbb-amq-0:61616
INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:61616 to pod sbb-amq-0:61616
INFO[14:13:58] Port-Forward: 127.1.27.7 idm:9006 to pod idm-0:9006
INFO[14:13:58] Port-Forward: 127.1.27.7 idm:80 to pod idm-0:9006
ERRO[14:14:01] ForwardPorts error: unable to listen on any of the requested ports: [{80 9006}]
I got an error in the last line of the log, so I have realized that all the hostnames related to ports 80 and 9006 were not attached to the IP, which means:
http://idm:9006 doesn't work
http://127.1.27.7:9006 works
However:
http://sbb-amq:8161 works as well (not using the port 9006)
Has anyone seen this before?
EDIT: I am using Ubuntu and the ports 80/9006 are not in use.
unable to listen on any of the requested ports usually means that you have something on your local workstation listening on those ports, 0.0.0.0:80 and 0.0.0.0:9006 in this case. The IP 0.0.0.0 means it's listening to those ports on all interfaces.
kubefwd uses local loopback IP addresses to allow the same port for multiple services so that you can have 127.27.1.1:80 -> someservice:80 and 127.27.1.2:80 -> someotherservice:80.
Unfortunately, when you have local applications using 0.0.0.0:80, you will not be able to bind 80 to any interface, as it is already being used. I don't know why applications often bind to every interface since localhost almost always points to 127.0.0.1.
You have a couple of options:
change the configuration of those other services to use a single IP such as 127.0.0.1
use the mapping flag and have kubefwd use a differnt port: -m 80:8080 -m 9006:9007

can ping 8.8.8.8 but not google.com

I just got a new router and internet connection.
My phone and my second computer have no problem to connect to internet (wifi or cable). My first computer, where I am running Limux Mint 18.1 Serena, can connect with cable or wifi but I am unable to browser.
I can ping 8.8.8.8 but not google.com.
I do not understand much of DNS but I tried to follow some online tutorials.
I tried to modify the /etc/resolconf directory by adding a resolv.conf file with a new servername but didn't work (even after restarting network-manager). I tried as well to modify the /etc/resolv.conf.d/tail file (as read in other tutorials) by adding a new servername but still not working.
Any suggestion?
Your DNS resolving doesn't work.
Check your firewall for an open port UDP/53 to 8.8.8.8
# iptables -L -n -v
Check with your ISP for DNS server provided. They are probably blocking UDP/53 somewhere on the way out to force you to use internal DNS server.
If you are on DHCP, renew the lease.
Depends on distro (most probably networkmanager, ifdown/ifup combination may work as well). This happens quite often with resolvconfd and dnsmasq. You may need to restart the NetworkManager then
Again - command depends on distro, usually with systemd
# systemctl restart NetworkManager
If you are on static IP and have noone to ask or check their config, you may sniff (tcpdump -nnvv -i <interface> udp port 53).
The problem occurs due to trouble with DNS setting
If you are using linux follow:
Clear this file content (root permission required)
nano /etc/resolv.conf
Add the folling text:
nameserver 1.1.1.1
nameserver 8.8.8.8
Save and Reboot
If using Windows Follow:
Control Panel\Network and Internet\Network and Sharing Center
Select current active connection (wifi/broadband)
Properties > Networking > ipv4 > custom dns > 1.1.1.1 & 8.8.8.8
check Validate setting upon exit > save

Raspberry PI IP address

I have a Raspberry PI and a Wi-Pi wireless dongle.
I want to connect the PI to the computer using Remote Desktop Connection via wireless.
But I'm not sure how to get the IP of the Raspberry (without having access to the router), that I need to connect to it.
Now I get into router's page and see what IP it assigned to the pi, and use it to connect
But my goal is to be able to use it on the "field", using the phone's "internet sharing" option, to connect the PI and laptop to it, and then connect to pi from the laptop.
How can I get the IP address that the phone gave to the PI?
You could make your Raspberry Pi speak its IP-address, like described here.
First, install the espeak package:
$ sudo apt-get install espeak
Then, create a init script:
$ sudo vi /etc/init.d/sayIPbs
Paste the following content into it:
#! /bin/sh
# /etc/init.d/sayIPbs
## Some things that run always
# Carry out specific functions when asked to by the system
case "$1" in start)
echo "Starting script sayIPbs "
sleep 5
public=`curl ifconfig.me`
private=`hostname -I`
string="public address is $public and private address is $private"
echo $string | espeak -s 120 -v en-uk
sleep 2
echo $string | espeak -s 120 -v en-uk
;; stop)
echo "Stopping script sayIPbs"
;; *)
echo "Usage: /etc/init.d/sayIPbs {start|stop}"
exit 1
;;esac
exit 0
Finally, issue these commands:
$ cd /etc/init.d
$ sudo chmod a+x sayIPbs
$ sudo update-rc.d -f sayIPbs defaults
$ sudo reboot
Plug in some headphones and listen to the ip address which will be read out at the end of the boot process.
You should configure your raspy to have always the same ip address. Try to edit your interfaces.man file with nano or cat command with your own parameters as shown below. Remember to reboot after editing:
pi#raspberrypi ~ $ cat /etc/network/interfaces.man
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.1.69
netmask 255.255.255.0
gateway 192.168.1.1
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.67
netmask 255.255.255.0
gateway 192.168.1.1
wpa-passphrase password
wpa-ssid myssid
I found that I can use nmap to "scan" the network for connected devices, and it will give me a list of devices and their assigned IP.
And since there's max 3 devices connected, the list is short and easy to read.
nmap -sP 192.168.1.1/24
Using just a button and an LED, I have written a script that gets the IP address of the Raspberry pi, and then blinks the LED repeatedly to show the IP address of the Raspberry Pi. I just count the blinks, note them down on paper, and then I have the IP address. It seems silly, but works with Just 2 I/O pins.
Use static IP on you pi by editing on /etc/network/interfaces. but, on the other way, you can also install network scanner on your phone.
Bit late answer, but I had similar issue intitially. Solved my problem in the following way:
Use the Unix terminal commands to identify the IP and the MAC address of wi-fi or ethernet port (ifconfig)
set up your router to always allocate a address to these respective network connections. use range outside what would be automatically generated with DHCP
Whenever you connect that raspberry Pi to your network it will automatically be allocated that address. I also put sticker on the pi with the mac and IP address. Especially useful if you are running it without screen and keyboard.

is it possible to get the MAC address for machine using nmap

I have a list of remote machines in a text files. Can I know their MAC addresses using nmap ?
If you're using nmap, MAC addresses are only available if you're on the same network segment as the target. Newer versions of nmap will only show the MAC address to you if you're running as root.
i.e.:
sudo nmap -sP -n 192.168.0.0/24
Use snmp-interfaces.nse nmap script (written in lua) to get the MAC address of remote machine like this:
nmap -sU -p 161 -T4 -d -v -n -Pn --script snmp-interfaces 80.234.33.182
Completed NSE at 13:25, 2.69s elapsed
Nmap scan report for 80.234.33.182
Host is up, received user-set (0.078s latency).
Scanned at 2014-08-22 13:25:29 Арабское время (зима) for 3s
PORT STATE SERVICE REASON
161/udp open snmp udp-response
| snmp-interfaces:
| eth
| MAC address: 00:50:60:03:81:c9 (Tandberg Telecom AS)
| Type: ethernetCsmacd Speed: 10 Mbps
| Status: up
| Traffic stats: 1.27 Gb sent, 53.91 Mb received
| lo
| Type: softwareLoopback Speed: 0 Kbps
| Status: up
|_ Traffic stats: 4.10 Kb sent, 4.10 Kb received
In current releases of nmap you can use:
sudo nmap -sn 192.168.0.*
This will print the MAC addresses of all available hosts. Of course provide your own network, subnet and host id's.
Further explanation can be found here.
Some scripts give you what you're looking for. If the nodes are running Samba or Windows, nbstat.nse will show you the MAC address and vendor.
sudo nmap -sU -script=nbstat.nse -p137 --open 172.192.10.0/23 -oX 172.192.10.0.xml | grep MAC * | awk -F";" {'print $4'}
if $ ping -c 1 192.168.x.x
returns
1 packets transmitted, 1 received, 0% packet loss, time ###ms
then you could possibly return the MAC address with arping, but ARP only works on your local network, not across the internet.
$ arping -c 1 192.168.x.x
ARPING 192.168.x.x from 192.168.x.x wlan0
Unicast reply from 192.168.x.x [AA:BB:CC:##:##:##] 192.772ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
finally you could use the AA:BB:CC with the colons removed to identify a device from its vendor ID, for example.
$ grep -i '709E29' /usr/local/share/nmap/nmap-mac-prefixes
709E29 Sony Interactive Entertainment
nmap can discover the MAC address of a remote target only if
the target is on the same link as the machine nmap runs on, or
the target leaks this information through SNMP, NetBIOS etc.
Another possibility comes with IPv6 if the target uses EUI-64 identifiers, then the MAC address can be deduced from the IP address.
Apart from the above possibilities, there is no reliable way to obtain the MAC address of a remote target with network scanning techniques.
Yes, remember using root account.
=======================================
qq#peliosis:~$ sudo nmap -sP -n xxx.xxx.xxx
Starting Nmap 6.00 ( http://nmap.org ) at 2016-06-24 16:45 CST
Nmap scan report for xxx.xxx.xxx
Host is up (0.0014s latency).
MAC Address: 00:13:D4:0F:F0:C1 (Asustek Computer)
Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds
I'm not cool enough to be able to comment on a post.
so I guess I need to make a new post.
However the above recommendation of
"sudo nmap -sn 192.168.0.0/24"
is the best quickest method to get the all the MACs for the IPs on your
local network/vlan/subnet
What the OP doesnt mention, is the only way to get the MAC address
this way, you MUST use sudo(or other super user privs i.e. windows admin)
the command
nmap -sn 192.168.0.0/24 will discover hosts on your network, however will not return the MACs as you are not in SU mode of operation.
Just the standard scan will return the MAC.
nmap -sS target
With the recent version of nmap 6.40, it will automatically show you the MAC address. example:
nmap 192.168.0.1-255
this command will scan your network from 192.168.0.1 to 255 and will display the hosts with their MAC address on your network.
in case you want to display the mac address for a single client, use this command make sure you are on root or use "sudo"
sudo nmap -Pn 192.168.0.1
this command will display the host MAC address and the open ports.
hope that is helpful.
Not using nmap... but this is an alternative...
arp -n|grep -i B0:D3:93|awk '{print $1}'

how to add the text record in the bonjour dns-sd

I am able to register a service using bonjour dns-sd on my linux pc.
$dns-sd -P SMARTCAM _ftp._tcp. . 80 AIR 14.99.8.77
Now I am unable to add text record with registration. Can some body tell me how to add the text record.
How about:
$dns-sd -P SMARTCAM _ftp._tcp. . 80 air.local 14.99.8.77 "u=test" "path=/pub"
I'm just not sure about the .local part of the name, compared to the apparently non-local IP address. What are you trying to do, exactly? I'd normally expect to see this registering a local IP address, e.g.:
$dns-sd -P SMARTCAM _ftp._tcp. . 80 air.local 10.1.1.58 "u=test" "path=/pub"
If you want to register a sub-type, for example, a printer, then you add the sub-type name after the main type name, comma-separated (thanks to this post for showing how to do it):
$dns-sd -P "Test Print" _http._tcp,_printer . 8080 air.local 10.1.1.58 "path=whatever"