Thursday, September 30, 2010

Changing IP or Hostname on Linux

--Linux/OS Installation

IP=10.224.8.151
Subnet Mask=255.255.255.0
Gateway=10.224.8.1

Domain=abc.com
DNS=10.224.8.126
         10.224.8.120

Make sure IP is unused.

Below show IP address associated with eth0(which is primary NIC card)

# ifconfig eth0

Below shows default gateway

# route -n

To Change IP
================

Bringing down a network interface with ifconfig

# ifconfig eth0 down

Bringing up an Ethernet interface with ifconfig

# ifconfig eth0 192.168.99.14 netmask 255.255.255.0 up

Setting the Default Route

# route add default gw 192.168.99.254


To Change Hostnme
===================

Backup and edit the the file /etc/sysconfig/network

HOSTNAME=.

this will be available after a reboot.

a quicker way, in memory change is- edit

Backup and Edit the file /proc/sys/kernel/hostname.

but that won't be saved when you reboot.

No comments: