Mac-os-x how to get network details like ip-address, subnet mask,etc - macos

I am new to Mac-OS-X development. I want to get the users Network details just for displaying it in my application. Details such as the IP address, Subnet mask, status whether connected or not, etc.
Is it possible to get the same??
And secondly, Is the IP address different for wireless lan connections and the normal ethernet connections?? I am a little weak at networking concepts.
Any help will be appreciated.
note: I already tried searching the apple developer site for leads but wat i could find is only the System Configuration Programming guide

Strange.. There are no Frameworks or classes to get the IP address... But i somehow managed to get my hands on the following information.. First with this reference.. And secondly i found that..
As mentioned in the link, If we manually set the IP, then it gets stored in the preferences.plist.
But if we set the IP to DCHP, then we can get the ConfigMethod as "DCHP" and hence check the com.apple.network.identification.plist, it'll have the details for the IP address.
Hence with the use of both the plist and checking whether the ConfigMethod is "Manual" or "DCHP" we can get the current IP address albeit this is not documented anywhere.

Related

Bash-Ubuntu 18.04-ROS-Melodic: Ping to IP address does not return anything

I have a Velodyne Puck 16 sensor that I have been trying to connect to ROS Melodic for the past few days. My OS is Ubuntu 18.04. I was able to find out the address of the lidar using WireShark, as it is possible to see below:
So the IP is: 10.0.1.201
After very very carefully following the installation procedure in the official documentation everything I was trying was unsuccessful.
So I decided to apply a simple ping procedure to the address of the lidar:
ping 10.0.1.201 it does not return any package of information despite it seems connected.
The problem I have is that, despite I know the IP address of my Velodyne 16 using Wireshark, the lidar does not answer to a simple test as the ping of the id.
Steps I followed:
1 Configure your computer’s IP
Below the connection procedure: I created a velodyne_interface connection, see below:
Existing Connection
velodyne_interface
2 Connecting your computer to LIDAR through terminal
emanuele#pc:~$ sudo ifconfig enp109s0 192.168.3.100
Add a static route to the LIDAR's IP address.
emanuele#pc:~$ sudo route add 10.0.1.201 enp109s0
3 Checking the configurations [Problem is here]
To check the connection open your web browser and access the following sensor’s network address.
The problem is that I never get to see the webpage showing the lidar data. Basically I never get to see the page below provided in the official documentation:
What is happening? Why is that happening?
There is probably some problems with the routing. You can try debugging the routing issues, some googling will probably help there. Some commands which might help pinpoint the problem tracepath -n 10.0.1.201 and ip route list.
The easiest solution to your problem would be to just configure the "velodyne_interface" you created to the same subnet as your velodyne lidar. So in the "velodyne_interface" set your ip to 10.0.1.20 for example. Connect to the "velodyne_interface" connection, verify that you have the ip you set by typing ip a or ifconfig in some terminal and you should be able to access the Velodyne web interface from 10.0.1.201. From there you can configure the velodyne sensor networking to the settings you like.

Can not join to active directory

I installed ws2016 server as a domain controller on virtualbox using internal network .
Everything was successfully installed about active directory and i created domain name as 'stark.local'
Also i created another ws2016 on virtualbox using internal network and I want to join new virtual machine to my domain controller.
Can ping dns server(which is my domain controller) and also Firewall off, no anti-virus installed.
However when i try to join dc it gives below error;
what i realized that i can not make nslookup to my dns server ip.
Even if on domain controller can not nslookup its self.
ipconfig of Domain Controller
ipconfig of node1;
I had no hair now and need your help.
Finally solved!
The problem was using internal network. I changed to host-only network and it worked.
AC DC
Using public IP addresses will always get you in trouble, try changing them to something like:
192.168.1.10 & 192.168.1.20
(Please read entire answer before modifying)
Also, i would recommend checking this link on the official microsoft forum. I know it's from windows 7, but i think the main problem you have is with the DNS configuration and it's very well explained there.
I'll summarise the link above here:
#Meinolf Weber's answer
If domain machines contain public DNS servers as 200.88.127.23 and 196.3.81.5 you will always have trouble.
Remove them on ALL domain machines and run ipconfig /flushdns and ipconfig /registerdns and reboot clients and domain member servers and restart the netlogon service on DCs instead reboot.
For internet access please configure the FORWARDERS in the DNS server properties in the DNS management console with the public DNS servers.
Explanation:
You can't join a machine to the domain using public IP because it is trying to locate your domain to the public IP which has not information of the private build domain.
Use only local IP in the clients NIC.
Hope it helps, if not please give more detailed information of the issue as well as the DNS configuration (screenshot or whatever you can).
EDIT 1: also check "time settings" on both machines, i know it might seem silly, but that sometimes gives DNS and DC issues. Check IPv6, could be another probable cause of the issues you're having (Go to the network and sharing center, modify the properties of the NIC and unselect TCP/IPv6).
I'd check first IPv6, that'll save you work if it's only that.
EDIT 2: again, i would recommend changing the IPs (if possible) to another network, as long as the 169.254.x.x is used (assigned) when there's no DHCP server, but as you say they can ping to each other, it may not be necessary the problem.
I can see there's no router in the network but, a Windows Server should be providing DHCP, otherwise things like DNS suffix don't work.
So check that:
- You have the DNS role installed and configured to support AD.
SOLVED on answer below
The explanation i would give for this is that "secure communication" is an often requirement, thing that internal network doesn't provide.

FTP Behind Firewall and Dynamic IP Address

I'm currently working on a client project and I get access to files via FTP. Their server is behind a firewall and they're asking me for my IP address, I'm guessing for whitelisting.
Problem is, my IP address is dynamic and it changes quite a lot throughout the day. Is there anyway around this?
Thanks in advance.
The best way to avoid paying for a static IP is to carry on using a dynamic IP address, but use a dynamic DNS provider such as No-IP which you can cause to update every time your IP address changes (routers will often do this for you automatically, or there are Windows / OSX / Linux (such as ddclient) clients). That way, you can just use something like magpie.no-ip.com instead of an IP address and it will always resolve to your public address.
You can find the whole answer here: https://superuser.com/questions/455226/can-you-configure-dynamic-to-be-static-yourself-without-changing-your-isp

Recaptcha IP addresses

Okay, so we implement Recaptcha in production. We get errors because it can't reach the IP address it needs to use the service. We open a port for the IP address to reach Google. No problem. We do that and configure that IP address explicitly to work. It works great. Then, the next day, we start getting errors again because Recaptcha is using a different IP address. I can allow requests from that IP address, too, but now I'm unsettled. Where are these addresses coming from? How do I configure this to work reliably?
Recatpcha from Google can use any Google IP address and there are lots of them.
Ran this from Windows:
_netblocks.google.com text =
nslookup -type=TXT _netblocks.google.com
"v=spf1 ip4:216.239.32.0/19 ip4:64.233.160.0/19 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:209.85.128.0/17 ip4:66.102.0.0/20 ip4:74.125.0.0/16 ip4:64.18.0.0/20 ip4:207.126.144.0/20 ip4:173.194.0.0/16 ?all"
That's all the network Google uses currently. These can change so check them often.
Google suggest allowing port 80 to all IPs outbound, this highly insecure. They recommend going through a proxy server but again that is highly insecure if your web server is an DMZ. Proxy aware trojans do exist. All that need to be done is exploit a vulnerability to execute arbitrary code and you can create reverse connection on port 80 through a proxy server to download the payload. Then it is trivial to escalate privileges and own the box. I don't mean just Windows servers but Linux as well. I've done it in lab environment on security was on. It's really easy to do.
This is the Google website I got this from:
http://code.google.com/p/recaptcha/wiki/FirewallsAndRecaptcha
I wanted to append to this answer with more recent information. The documentation that Chris is pointing to does not include all of the TXT records necessary to dig (thanks Google):
_netblocks2.google.com (IPv6 subnets)
_netblocks3.google.com (Additional IPv4 subnets)
In my particular case, the _netblocks3 entry contained 2 large /19's that made my initial rule ineffective
(I found additional references here: https://support.google.com/a/answer/60764?hl=en)
Perhaps you should be using a hostname rather than IP

host network solutions domain on an amazon ec-2 box

I have looked this up and what was described in other answers did not work for me. I created a elastic ip from my ec-2 dashboard, and I set the A records of my domain (www, *, and #(none)) but it does not work. When I try to go directly to the ip address it also does not work though so I am not sure why this is happening.
Also where exactly does the elastic ip point? To my home folder, to the ec-2 user? It is not working now so I couldn't test it, but when it does work I still won't know.
Two things: remember that your domain will need to propagate, so leave it a few hours. Also, your elastic IP points to the machine you bound it to.
Almost forgot, you also need to edit your security zone to open up ports to allow incoming connections on those ports, as the default is to block everything except SSH.

Resources