Setting up network ip address with Linux (Redhat/centos/ubuntu)
1:07 PMNetwork Configuration can be done by couple of ways
use the following commands
Ifconfig : display the network Setting
Ifconfig –a : display all the adaptors/settings/configurations
ifconfig eth0 down ; power down the Ethernet adaptor eth0
ifconfig eth0 up : power up the Ethernet adaptor eth0
ifconfig eth0 192.168.1.1 : set eth0 adaptor to ip address to 192.168.1.1
ifconfig eth0 netmask 255.255.255.0 : set eth0 adaptor to subnet mask to 255.255.255.0
ifconfig eth0 broadcast 192.168.2.255 :Change Broadcast address of the interface eth0.
ifconfig eth0 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255 : Assign ip-address, net mask and broadcast at the same time to interface eht0.
to perform things in advance configuration you can also use Network Configuration File
Redhat linux : vi /etc/sysconfig/network-scripts/ifcfg-eth0
Ubuntu : sudo vi /etc/network/interfaces
Entries needed to be like this
DEVICE=eth0
BOOTPROTO=STATIC
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes
Service Restart Need
Redhat
$ sudo /etc/init.d/network stop
$ sudo /etc/init.d/network start
ubuntu
# sudo /etc/init.d/networking restart
# service NetworkManager stop
3 chkconfig NetworkManager off
Confirmation
###### /sbin/chkconfig network
for binding two different network adaptor as teaming > create Virtual adaptor and make two or more physical adaptor as slave’s and edit the following files like below
#/etc/modprobe.conf
#added for bonding
alias bond0 bonding mode=5 miimon=100
#/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
#/etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
#/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.0.1
NETMASK=255.255.255.0
USERCTL=no
Note : the mode for the load balance is different on your infrastructure- please check for yourself accordingly
Mode=0 : round robin policy
mode=1 : active -backup policy
mode=2 : balance-xor depedingin on traffic of destination mac address
mode=3 : broadcast polocy
mode=4 : dynamic link aggregation
Mode=5 : load balanced on transmiting package mode
Mode=6 : adaptive load balancing
____________________________________________________________________________________________________________________________________________________
Ubuntu: https://help.ubuntu.com/community/NetworkConfigurationCommandLine/Automatic
Redhat :http://unix.stackexchange.com/questions/52474/setup-static-ip-in-redhat-6
____________________________________________________________________________________________________________________________________________________
0 comments