Wise people learn when they can; fools learn when they must - Arthur Wellesley

Saturday, 15 April 2017

RHEL6 - 25 - VIRTUAL IP


RHEL6-25-VIRTUAL IP


HOW TO CONFIGURE VIRTUAL IP IN RHEL6?

Before configuring virtual IP we need to know how many network interfaces are available?

Various ways to find available Network Interfaces on the RHEL system.


[root@rhel6-test1 ~]# lspci |grep -i Ethernet
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:05.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:06.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:07.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:08.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:09.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
02:0a.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

[root@rhel6-server ~]# ifconfig –a

[root@rhel6-test1 ~]# ip a

[root@rhel6-test1 ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:32:41:5e brd ff:ff:ff:ff:ff:ff
3: eth3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP qlen 1000
    link/ether 00:0c:29:32:41:68 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
    link/ether 00:0c:29:32:41:7c brd ff:ff:ff:ff:ff:ff
5: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
    link/ether 00:0c:29:32:41:7c brd ff:ff:ff:ff:ff:ff
6: eth4: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP qlen 1000
    link/ether 00:0c:29:32:41:68 brd ff:ff:ff:ff:ff:ff
7: eth6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:0c:29:32:41:90 brd ff:ff:ff:ff:ff:ff
8: eth5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:32:41:9a brd ff:ff:ff:ff:ff:ff
9: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 00:0c:29:32:41:7c brd ff:ff:ff:ff:ff:ff
10: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 00:0c:29:32:41:68 brd ff:ff:ff:ff:ff:ff
11: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
    link/ether 06:2c:2b:62:a8:8e brd ff:ff:ff:ff:ff:ff

[root@rhel6-test1 ~]# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:     719      11    0    0    0     0          0         0      719      11    0    0    0     0       0          0
  eth0:   52365     553    0    0    0     0          0         0     2544      40    0    0    0     0       0          0
  eth3:   47983     532    0    0    0     0          0         0      768      14    0    0    0     0       0          0
  eth2:   48205     536    0    0    0     0          0         0   163899    1168    0    0    0     0       0          0
  eth1:  138740    1492    0    0    0     0          0         0   173868    1162    0    0    0     0       0          0
  eth4:   50215     550    0    0    0     0          0         0     2538      26    0    0    0     0       0          0
  eth6:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth5:   16033     163    0    0    0     0          0         0     2244      38    0    0    0     0       0          0
 bond0:  186945    2028    0    0    0     0          0         0   337767    2330    0    0    0     0       0          0
 bond1:   98198    1082    0    0    0     0          0         0     3306      40    0    0    0     0       0          0
  pan0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0


By these way we can find the no of interfaces our system have.

I will configure virtual IP with “eth5”

[root@rhel6-test1 ~]# ifconfig eth5:0 192.168.234.149 netmask 255.255.255.0

Though the virtual interface is configured and live as well, but this is not permanent. 

HOW TO MAKE VIRTUAL INTERFACE PERSISTENT

[root@rhel6-test1 ~]# ifconfig eth5:0
eth5:0    Link encap:Ethernet  HWaddr 00:0C:29:32:41:9A
          inet addr:192.168.234.149  Bcast:192.168.234.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

[root@rhel6-test1 ~]# cd /etc/sysconfig/network-scripts/

[root@rhel6-test1 network-scripts]# cp ifcfg-eth5 ifcfg-eth5:0

[root@rhel6-test1 network-scripts]# vi ifcfg-eth5:0

[root@rhel6-test1 network-scripts]# cat ifcfg-eth5:0
DEVICE=eth5:0 çççChange
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
HWADDR=00:0C:29:32:41:9A
IPADDR=192.168.234.149 çççChange
PREFIX=24
GATEWAY=192.168.234.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth5:0" çççChange

[root@rhel6-test1 ~]# service network restart
Shutting down interface bond0:                             [  OK  ]
Shutting down interface bond1:                             [  OK  ]
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth5:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:                               [  OK  ]
Bringing up interface bond1:                               [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth5:                                [  OK  ]

[root@rhel6-test1 ~]# ifconfig –a

================O/P REMOVED========================================
eth5:0    Link encap:Ethernet  HWaddr 00:0C:29:32:41:9A
          inet addr:192.168.234.149  Bcast:192.168.234.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
================O/P REMOVED========================================


[root@rhel6-test1 ~]# ifconfig eth5:0
eth5:0    Link encap:Ethernet  HWaddr 00:0C:29:32:41:9A
          inet addr:192.168.234.149  Bcast:192.168.234.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1




No comments:

Post a Comment