Sometimes as a DBA you may find yourself in a database server environment without any graphical interface and you are forced to use the command line to setup the network. The procedure below shows you how to do that:-
You setup a dynamic IP by editing the file:
/etc/sysconfig/network-scripts/ifcfg-eth0 as root user
It should look like this:
DEVICE=eth0
HWADDR=08:00:27:37:A4:23 -------- ( ! replace with your network device macc addr )
TYPE=Ethernet
UUID=6c8852cb-7819-46a3-9d ------- ( ! must not be the same)
ONBOOT=yes --- ( ! very important)
NM_CONTROLLED=yes
BOOTPROTO=dhcp
For static ip edit the same file if you are using the device eth0 and just add the following:
DEVICE=eth0
BOOTPROTO=STATIC
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
After saving the changes, you need to restart the network daemon using the following command:-
$ sudo /etc/init.d/network stop
$ sudo /etc/init.d/network start
This should provide IP address to eth0 interface also. And ifconfig command should list eth0 also.
After you configure the ip address run the following commands:-
# service NetworkManager stop
# chkconfig NetworkManager off
It will retain the provided ip even after booting.
Also if you just want to quickly setup a network device run the command ifconfig -a to get the device name.
Once you get the name you want to setup use the following command:-
ifconfig eth0 192.168.0.5 netmask 255.255.255.0
Comments
Post a Comment