0

First of all I am so sorry that this question might be so rudimentary to ask here but I need to know it.

I am connecting my laptop in many wi-fi networks every day while roaming. So my IPv4 is in DHCP mode thus takes a different IP address in a different network. But now I have to edit my network scripts (CentOS7, eth-0) and set a fixed IP address there.

( The reason I want to do this is because I want to set up a hadoopmulti node cluster. Home machine will be the master node and two CentOS7 Vmware will be data nodes. So I need to setup 3 IP addresses on 3 machines and talk between them via SSH. )

Now my question is Can I set up my IP address as static one? Then if I roam into a new network what's going to happen? Do I have to change the IP address again if it(the staic IP that I set) does not fall in the range of that network's DHCP IP range?

Please clarify this to me if you please and also if some one know how to do this basic kind of network setup better please also do advise and suggestions.

Thanks and regards

2
  • Unfortunately, host, server, and VM configurations are off-topic here. You could try to ask this question on Server Fault for a business network, or on Super User for a personal network.
    – Ron Maupin
    Aug 18 '16 at 4:45
  • Sadly I can't reply now that this question is on-hold, but this is possible. Add secondary addresses to your NIC (while maintaining DHCP as the primary address) by putting the following in your /etc/network/interfaces: iface eth0 inet dhcp and then inet iface eth0 static address x.x.x.x/y Aug 18 '16 at 7:32
3

If you only need the IP to be fixed on one network, than the simplest approach is to make a static DHCP reservation on the DHCP server for that network specifically. That way your machine stays in DHCP mode all the time, but will always get the same address when it connects to that specific network.

Not the answer you're looking for? Browse other questions tagged or ask your own question.