|
Configuring IP on Linux from the Command Line
(RedHat,CentOS,Fedora)
This
guide assumes that you are adding an the IP on eth0. If you are doing this on
another Eth card (i.e. eth1) just adjust the eth numbers accordingly
Step 1 -Add IP Address
vi /etc/sysconfig/network-scripts/ifcfg-eth0
and configure like
the following (pick any IP address available on your network)
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
IPADDR=192.168.1.105
NETMASK=255.255.255.0
NETWORK=192.168.1.0
HWADDR=00:50:FC:4B:B8:98
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=no
GATEWAY=192.168.1.1
Step 2 Restart the NIC
network service restart
Step 3 - Add the Default Route:
Default Route:
route add default
gw ip_address_of_your_default_gateway
eth0
route add default gw 192.168.1.1 eth0
To make gw/route
permanent:
vi /etc/sysconfig/network
to make look like
this:
NETWORKING=yes
HOSTNAME= localhost.localdomain
GATEWAY=192.168.1.1
Step 4 - Add DNS Servers
vi /etc/resolv.conf
so it looks like
this:
search yourdomain.com
nameserver 192.168.1.37
nameserver 192.168.1.36
nameserver 192.168.1.38
|