Setting a static or DHCP IP in Linux - Printable Version +- howtothings.co.uk (https://www.howtothings.co.uk) +-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4) +--- Forum: Operating System and Software Support (https://www.howtothings.co.uk/forumdisplay.php?fid=17) +--- Thread: Setting a static or DHCP IP in Linux (/showthread.php?tid=577) |
Setting a static or DHCP IP in Linux - Mark - 26-11-2010 Setting a static or DHCP IP in Linux This is a tutorial on how to set either a static or DHCP IP address in Linux. This is useful for Linux servers in your LAN. We'll be working with the /etc/network/interfaces file Steps Setting a static IP 1) To set a static IP Code: nano /etc/network/interfaces And enter the following, changing to suit your needs Code: auto eth0 2) You will also need to make sure you set a nameserver in /etc/resolv.conf Code: nano /etc/resolv.conf Code: nameserver 192.168.2.1 Setting a DHCP IP DHCP, Dynamic host configuration protocol, (automatically assigned) 1) This is how to set your interfaces to DHCP. Code: nano /etc/network/interfaces Enter the following Code: auto eth0 Remember to change the settings to suit you, a lot of yous wont be on a *.2 network like i am, you'll probably be 192.168.1.* |