I am trying to streamline access to a Ubuntu 14.04 LTS dev-server I run as a VM on my laptop and am having various issues with DNS configuration on my laptop, VM guest, and ISPConfig (which I run on the guest). As you can imagine, I take my laptop with me to different locations where the surrounding network settings vary. The main ones I'm trying to streamline are Home and University. At Home, I use my iPhone as an access point, and I have a D-Link router that connects to it using WiFi. The rest of my network (2 laptops, and a raspberryPi) are hardwired to the D-Link device. The D-Link router does provide WiFi, which I use occasionally for BYO devices and my laptop when I am working in another room. At Uni, I normally connect to the network in my lab via a wired connection, though occasionally I will use WiFi when I need to walk around with my laptop. Sometimes when I'm at Uni, I connect to my iPhone directly using WiFi to circumvent my Uni's firewall settings. What I mean by 'streamline' is that I would like to be able to access the VM in each location without needing to first reconfigure it in VirtualBox and then restart it. Restarting network services is fine as I obviously need to do so in order to acquire new IPs. The main problem has to do with interfaces and IP addresses used at each location. My laptop is a MacBook Pro running macOS and I'm using VirtualBox. My laptop has a number of interfaces, a complete list is shown below, but I only use en0 (WiFi Airport) and en5 (Thunderbolt Ethernet adapter). I have configured my server with two interfaces, one for each of these adapters on the notion that at any point, at least one of these will be active. However, on the Mac, when I turn off its WiFi, the AirPort interface is not available to VirtualBox and eth0 stops working, and likewise, if I don't have the Thunderbolt Ethernet adapter plugged in eth1 stops working. With en0 unavailable, the boot is very slow since Ubuntu waits for up to 60 seconds to complete the network configuration. Naturally these devices have different mac and IP addresses. Because each of the above situations produces different IP addresses for my VM, I have to spend a lot of time 'adjusting' my VM before I can use it. Previously, I manage this by editing my hosts file, but that is getting to be a bit cumbersome now. One measure I tried was to create an A record, and Name Server for each of the possible IP addresses with very short DNS update times. This sort of works except that the 'non-existent' servers get in the way of resolving the domain names I have in the DNS. I'm considering writing a script that checks the network state and addresses on the VM and updates the DNS data in ISPConfig's database for each of the domains I host, which would then update the PRI records in /etc/bind9. But this does not solve the problem of setting DNS servers on the host, and my router when I'm at home. Another problem I'm having is with the definition of multiple DNS servers on my host. It appears to me the host is not moving to the next server in the list when it's not live. For some reason, the router (if you look at the MAC address in Wireshark) is sending messages on behalf of the 'off-line' DNS server, if you look at the IP address. There is also a problem with caching old entries, which I read about in the ISPConfig manual but did not really understand ('Also Notify' and 'ACL'). I'm wondering if anyone else has tackled this kind of situation and may be able to offer some advice on how best to set this up? Network Interfaces Code: lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500 ether xx:xx:xx:xx:xx:xx nd6 options=201<PERFORMNUD,DAD> media: autoselect (<unknown type>) status: inactive en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500 options=60<TSO4,TSO6> ether xx:xx:xx:xx:xx:xx media: autoselect <full-duplex> status: inactive en2: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500 options=60<TSO4,TSO6> ether xx:xx:xx:xx:xx:xx media: autoselect <full-duplex> status: inactive p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304 ether xx:xx:xx:xx:xx:xx media: autoselect status: inactive awdl0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> mtu 1484 ether xx:xx:xx:xx:xx:xx nd6 options=201<PERFORMNUD,DAD> media: autoselect status: inactive en5: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV> ether xx:xx:xx:xx:xx:xx inet6 fe80::xxx:xxxx:xxxx:81d2%en5 prefixlen 64 secured scopeid 0x9 inet 192.168.0.2 netmask 0xfffffff0 broadcast 192.168.0.15 nd6 options=201<PERFORMNUD,DAD> media: autoselect (100baseTX <full-duplex,flow-control>) status: active bridge0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500 options=63<RXCSUM,TXCSUM,TSO4,TSO6> ether xx:xx:xx:xx:xx:xx Configuration: id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0 maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200 root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0 ipfilter disabled flags 0x2 member: en1 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 5 priority 0 path cost 0 member: en2 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 6 priority 0 path cost 0 media: <unknown type> status: inactive utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000 inet6 fe80::xxxx:xxxx:xxx:5215%utun0 prefixlen 64 scopeid 0xb nd6 options=201<PERFORMNUD,DAD> two network interface that I use , plus others, see list below.
First, i have to say the idea of a "mobile web server" is for me, and i mean no disrespect, simply nuts! Perhaps it is so nutty there is actually brilliance in such an idea? Sorry i dont have a solution that you may be searching for, however perhaps there is a simpler way... For about $6 US month register a micro google cloud compute instance, install ubuntu LAMP on it (takes about 5 minutes), go through the ispconfig installation process, access this instance from your laptop and a pocket wifi (or your phone hotspot...which is a rather expensive option compared with pocket wifi btw), and voila...problem solved! You can setup a tunnel to the gce instance for security if you wish. One thing is for certain, no more dns headaches ^_^
Well, it's not actually a 'mobile web server'. It's a dev server that I have on my local machine that I use for ... development, before I upload to the production server that is in a data-center. Secondly, I don't have the bandwidth to efficiently utilise a cloud service, nor am I always able/willing to be online when I want to do development work. My laptop is more than simple 'dumb' terminal and I it makes a lot of sense to utilise its capabilities. Hence the specific question concerning the nature of the set-up I'm trying to streamline.
In my limited understanding of these things i dont see any other way of doing what you are trying to achieve whilst you are constantly changing networks and default gateways. Some kind of cronjob script to detect gateway changes may be the only option...but, and i might be wrong in this, i think the script would need to be installed on the laptop O/S itself rather than the virtual machine because the laptop is a bit like a NAT...your virtual machine isnt the device with the external ip address, the laptop is. What i would suggest is that you treat the laptop development server as just that...a local development server. Add an ftp client, setup an ssh tunnel (using putty for example) and communicate with the cloud server using this method. You can then simplify this equation such that the one necessary part of such an equation exists...a "web server" somewhere in the chain with a static external ip address. If your mobile data plans are simply not large enough to allow regular mobile network uploads for this development environment, then might i suggest you focus on synchronising only those files which are changed (vs uploading the entire development environment each time). Filezilla has this capability built right in...it will not only save a considerable amount of upload time, but also dramatically reduces bandwidth requirements.