Thursday 8 March 2012

How can you check if your Linux machine on network has static or dynamically allocated IP? How can you change it from dynamic to static?


How can you check if your Linux machine on network has static or dynamically allocated IP?
How can you change it from dynamic to static?
Ans:

Network configuration file can be looked at for checking if Linux machine has static or dynamically
allocated IP. ifconfig can be used to check currently allocated IP.
In Ubuntu the configuration file is /etc/network/interfaces. For dynamically allocated IP, it should state
dhcp, e.g following entry:
iface eth0 inet dhcp
In order to change it to static IP allocation, dhcp should be changed to static and IP address, subnet
mask, network address, broadcast address and gateway need to be mentioned. E.g. :
iface eth0 inet static
address 10.1.10.54
netmask 255.255.255.0
network 10.1.10.0
broadcast 10.1.10.255
gateway 10.1.10.1
Networking service needs to be restarted after making this change.
sudo /etc/init.d/networking restart

0 comments:

Post a Comment

 
Free Host | lasik surgery new york