I am trying to find a way that I can effectively change the IP and netmask of the computer that my programs are running on. I have to be able to maintain communications with a "box" that the user has access to and can change the IP of that box (but not that of the Linux host). Luckily the box broadcasts its IP over a multicast address. I am able to read that address and communicate to whatever IP the box is broadcasting. However, my problem is that when the box changes IPs outside of the subnet of the Linux host, I lose connectivity (as I would expect to happen).
As a result, I need a quick and dirty way to to change the IP and netmask of the Linux host when it detects that the IP being broadcast is outside it's subnet. I am aware that I can modify/edit the /etc/networking/interfaces file, but I was hoping to have something "live" where I wouldn't need to restart the networking interface or Linux host. Additionally, I would like to maintain all sockets that I have currently open during the change. My main issue is that I have a slew of connections run by other applications that cannot be corrupted as a result of the IP changeover. Also, if possible, I'd like to avoid having to redo having to run the multicast route add command for Linux after the host IP changeover.
Is there anything that I can do to satisfy these requirements? Thanks.
You don't want to change the IP address of the interface, you want to add an additional IP address and subnet to the interface. Search your Linux system documentation for IP Alias functionality.
Here's the HOWTO.
Related
Several days ago, AWS suddenly started blocking my ability to SSH to ANY of the EC2 servers I've setup across multiple accounts.
When I try to connect I get a message about "client_loop" disconnect and Broken Pipe.
But I can't figure out why. It's not the servers themselves. It has to be Amazon somehow. It's not my SSH keys. It's not my IP address alone. It can't be my mac address alone.
I can VPN to another country and SSH in like I normally would do. This made me think IP Address.
I can connect to my phone's hotspot and then I can SSH as usual. Again, made me think IP Address.
I then decided to try my son's PC (I'm on a mac) and just using the home network like my computer uses, his computer can SSH in. This tells me it's NOT the IP Address alone. So the only thing I can figure is that it must be a combo of IP and Mac address. I can't think of anything else that could be blocking it.
But I have several clients with servers in different AWS data centers and none are configured to block the IP address. But all of them are inaccessible.
I'm very confused as to what to try next. Looking for ideas.
Thanks!
Depending on the OS, check against the audit log of the server itself.
AWS will not be blocking based on Mac Address but its possible that the host OS might have. Outside of that give your home machine a reboot and try again.
I have a virtual machine instance running on Google Cloud Compute Engine — a preemptible free-tier CPU running Ubuntu 17.04. The end goal is to connect it to a MongoDB running on my local machine, a 2015 Macbook Pro (OS 10.12.6). But first, I've been trying to ensure the VM can reach my Mac via ping.
Running ping <VM's external IP> from my Mac works.
pinging my Mac from another Mac on the same wifi network works.
Running ping <Mac's IP> from the VM via the browser terminal does not work.
I've disabled my Mac's firewall. I've also configured my VM's firewall rules to allow all inbound and outbound traffic, to no avail:
ingress firewall rules, egress firewall rules
How might I get this instance to ping my Mac successfully?
Does your Mac's IP address begin with 10., 192.168., or between 172.16. and 172.32.? These are private addresses only reachable within your Mac's local network, which is (part of) why GCE cannot reach your VM.
This is part of a very common configuration. An ISP only allocates one (or a small number) of IP addresses to your home or business. A router on the network performs NAT to share that IP addess between computers on the local network, which instead use private IP addresses for themselves. As the router doesn't know what to do with the inbound MongoDB traffic, it blocks it.
There are two common ways around this that are usually found in your router settings:
"port forwarding" where you tell the traffic to forward all traffic on port 1234 to your Mac. This can get MongoDB working, but not ping.
If you have whole extra IP addresses, "DMZ" where your router directly forwards an entire extra IP to your instance. If you have only one IP address this is not an option as that IP is needed to be shared for other devices on the Wifi.
You likely also have a firewall on the router. If you use a DMZ or port-forwarding you must make sure that firewall allows traffic through too.
That said, I'm not sure that this is a sensible thing to do. Opening up your local network to the internet can create major security issues, plus it is likely unreliable more expensive (free tier only provides 1GB egress/month, your db traffic could exceed this).
Actually running MongoDB on instances within GCE is almost certainly a better option in every regard for you.
First off, the base question: how to reliably achieve IP/DNS resolution on a mixed network (Linux, Windows, Mac OS), on a common private physical network using IPV4/6, to hosted VM'S that may or may not have VPN's active and DHCP - without an internal DNS.
My Setup:
I run a Windows 10 Host machine with a static IPV4 address, which powers multiple Windows 10, and Linux VM's. Some of the VM's access VPN's, which run IPV4/6 VPN networks. Presently I use a Mac OS computer to RDP to the host system, and I use the Virtual Box GUI to access the systems from there.
I have tried using RDP (Microsoft), to access the VMs independently from my Mac OS system, however this only works through the Local IPV4 address when the VPN is not active - or the IPV6 address with the limitations noted below.
I have also tried using the IPV6 address; and while this works some of the time, I have have mixed to unpredictable results with this on reboots/IP refreshes. The IPV6 Address changes periodically, and I have to log into the router to determine the new address and update RDP entries accordingly.
What I am trying to achieve:
Mac OS system Source system, and RDP to multiple Physical/Virtual machines on the network, while maintaining connectivity through VPN connections on the VMs - Without having to manually type in/keep up with IPV6 addresses.
My hardware is all consumer grade, with a Netgear router (R6400).
While currently I use a single NIC in the VM host, I do have multiple NIC's if that will correct the connectivity issues.
MS-Windows implements RFC-4941 and RFC-7721, for security considerations, that lead to IPv6 address changes (this should not be a problem if you had DNS updates, but this is not your situation).
To avoid IPv6 changes, just use the following 4 lines on your Windows hosts:
netsh interface ipv6 set privacy state=disabled store=active
netsh interface ipv6 set privacy state=disabled store=persistent
netsh interface ipv6 set global randomizeidentifiers=disabled store=active
netsh interface ipv6 set global randomizeidentifiers=disabled store=persistent
You should now get predictable results.
So I know to access my host computer's localhost from virtualbox, I can hit up the IP 10.0.2.2. However, I need to access a different IP on my host. I've set up another local site running on host at 192.168.7.9. How do I hit this IP from inside virtualbox? Thank you.
Your virtual machine is probably in NAT networking mode.
You need to change networking to Bridged and choose the same Network adapter
like i did on the image below...(on my laptop wifi NIC is Intel Centrino, yours is probably different!)
Then your virtual machine will be directly connected to the same network as your laptop and it'll have a similar IP address as your host... 192.168.7.x
and then you can connect to any IP address you want!
This would be the simplest way to do it.
I am trying to make a C++ program in Windows that will output all of the ip addresses on the network to a text file but I have not been able to find anything useful online for other computers on the network. I figured out how to query the registry and find the local ip but I dont even know where to start to find other ip addresses. I don't want a copy-paste cookie cutter code because I want to learn how it works so if I could just get a link or a book that will guide me in the right direction that would be great.
For what purpose do you want to gain these IPs anyway?
I suspect what you're looking for is a way to obtain all possible IPs in a given subnet, which can be done quite trivially for say, IPv4. You simply take the IP address of your machine or router, and apply the subnet mask to it using bitwise and. (eg, 192.168.1.20 & 255.255.255.0 = 192.168.1.0, called the base, or network address). The valid hosts in this network are basically all of the bits which are zero in the subnet mask (255 in the previous example). This means the range 192.168.1.0 - 192.168.1.255 (exclusive, as the network address and broadcast address are not valid IP addresses of hosts in the network) are valid IP addresses of hosts.
There's no truly reliable way for any machine on the network other than the router to obtain specific information as to which of these addresses are in use though, as the interaction between machines on a network is meant to be voluntary, not implicit. Most machines however are generally running some kind of protocol which enables them to discover each other for purposes like printer and file sharing.
You can attempt to ping each of the possible host addresses in the network, or port scan, or talk to them with some protocol they might know. Alternatively you can use the broadcast address with a known protocol to ask all machines on the network to report back to you, and if they're running some software which talks that protocol, they'll respond with their own addresses.