31 janeiro 2010

Howto: Ubuntu Linux convert DHCP network configuration to static IP configuration

Your main network configuration file is /etc/network/interfaces

Desired new sample settings:
=> Host IP address 192.168.0.100
=> Netmask: 255.255.255.0
=> Network ID: 192.168.0.0
=> Broadcast IP: 192.168.0.255
=> Gateway/Router IP: 192.168.0.254
=> DNS Server: 192.168.0.254

Open network configuration file

$ sudo vi /etc/network/interfacesOR
$ sudo nano /etc/network/interfaces
Find and remove dhcp entry:

iface eth0 inet dhcp
Append new network settings:

iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254

Save and close the file. Restart the network:

$ sudo /etc/init.d/networking restart
Task: Define new DNS servers
Open /etc/resolv.conf file

$ sudo vi /etc/resolv.conf
You need to remove old DNS server assigned by DHCP server:

search myisp.com
nameserver 192.168.0.254
nameserver 202.55.0.25
nameserver 202.55.0.31

Nenhum comentário:

Postar um comentário