Simulate Linux dual-NIC dual IP for multipath multi-Path connection storage

Source: Internet
Author: User

simulate Linux dual-nic dual IP for multipath multi-Path connection storage

system (centos6.5:oracle-1) :

Eth0:192.168.21.23/24

Eth1:172.16.112.17/24

Storage ip:192.168.21.230

to configure iSCSI storage first , and then next, I've configured two iscis Storage

NIC Routing Configuration

Because there can only be one gateway, adding a static route enables two-NIC communication


1. edit the NIC eth0,eth1

Set up the configuration file without adding a default gateway

# vi/etc/sysconfig/network-scripts/Ifcfg-eth0

device=eth0

Type=ethernet

Onboot=yes

Nm_controlled=yes

Bootproto=static

Ipaddr=192.168.21.23

netmask=255.255.255.0

# vi/etc/sysconfig/network-scripts/ifcfg-eth1

device=eth1

Type=ethernet

Onboot=yes

Nm_controlled=yes

Bootproto=static

Ipaddr=172.16.112.17

netmask=255.255.255.0


2, Configure the default gateway for any one, this default gateway, determines the system actively to use the network, the use of the interface

Modifying a configuration file

# vi/etc/sysconfig/network

Networking=yes

Hostname=oracle-1.localdomain

#NTPSERVERARGS =iburst

Gatewaydev=eth0


3. Add route table

# echo "Net_21" >>/etc/iproute2/rt_tables

# echo "net_112" >>/etc/iproute2/rt_tables


4, Add the original path return route

# IP route Flush Table net_21

# IP route add default via 192.168.21.1 deveth0 src 192.168.21.23 table net_21

# IP rule add from 192.168.21.23 tablenet_21

# IP route Flush Table net_112

# IP route add default via 172.16.112.1 deveth1 src 172.16.112.17 table net_112

# IP rule add from 172.16.112.17 tablenet_112


5. Verify that the two IPs can be ping through the other machine

# ping 192.168.21.23

# ping 172.16.112.17


6. Automatic add route for power on

# cat >>/etc/rc.local << Eof

>ip Route Flush Table net_21

>ip route add default via 192.168.21.1dev eth0 src 192.168.21.23 table net_21

>ip rule add from 192.168.21.23 tablenet_21

>ip Route Flush Table net_112

>ip route add default via 172.16.112.1dev eth1 src 172.16.112.17 table net_112

>ip rule add from 172.16.112.17 tablenet_112

>eof

installing ISCSI Store Initiator

1. Yum installs iSCSI

# yum-y Install Iscsi-initiator-utils

# chkconfig iSCSI on

2. build two iSCSI initiator Files

# iscsiadm-m Iface-i Iscsi_eth0--op=new

# iscsiadm-m Iface-i iscsi_eth1--op=new

3, establish the network card mapping relationship

# iscsiadm-m iface-i iscsi_eth0--op=update-n iface.net_ifacename-v eth0

# iscsiadm-m iface-i iscsi_eth1--op=update-n iface.net_ifacename-v eth1

4. ISCSI Storage Discovery

# iscsiadm-m Discovery-t sendtargets-p192.168.21.230:3260

5. Restart the iSCSI Service, and then view the disk connection ( you can see that the connection is successful )

# Service iSCSI Restart

# ISCSIADM-M Session


installing multipath Multi-Path mounted disk

1. Yum installation multipath

# yum install-y device-mapper-persistent-data device-mapper-multipathdevice-mapper-libs device-mapper-event-libs Device-mapper-multipath-libsdevice-mapper device-mapper-event

2. load multipath module

# modprobe Dm-multipath

# modprobe Dm-round-robin

3. Create A multipath configuration file

# cat >/etc/multipath.conf << Eof

>defaults {

> User_friendly_names Yes

}

>eof


4. View the UID number of the mounted storage (because it is multipath, two identical UID numbers will appear )

# Multipath-v3 | grep UID

Jan 18 16:29:59 | Sdb:getuid =/lib/udev/scsi_id--whitelisted--device=/dev/%n (config file default)

Jan 18 16:29:59 | Sdb:uid = 36001405a75df6ded0277d3bf3dae7ddb(callout)

Jan 18 16:29:59 | Sdc:getuid =/lib/udev/scsi_id--whitelisted--device=/dev/%n (config file default)

Jan 18 16:29:59 | Sdc:uid = 36001405a75df6ded0277d3bf3dae7ddb(callout)

Jan 18 16:29:59 | Sdd:getuid =/lib/udev/scsi_id--whitelisted--device=/dev/%n (config file default)

Jan 18 16:29:59 | Sdd:uid = 36001405b363aaa9d92bad39c9dbd7bdd (callout)

Jan 18 16:29:59 | Sde:getuid =/lib/udev/scsi_id--whitelisted--device=/dev/%n (config file default)

Jan 18 16:29:59 | Sde:uid = 36001405b363aaa9d92bad39c9dbd7bdd (callout)

UUID Hcil Dev dev_t pri dm_st chk_st Vend/pro


5. Add the UID number into the configuration file for multipath access

# cat >>/etc/multipath.conf << Eof

>blacklist {

>devnode "^SDA"

>devnode "^sdb"

> devnode "^SDC"

}

>multipaths{

> multipath{

> WWID36001405A75DF6DED0277D3BF3DAE7DDB

> Alias Mpath1

}

>multipath{

>wwid36001405b363aaa9d92bad39c9dbd7bdd

> Alias Mpath2

>}

}

>eof


6. Start the service

#/ETC/INIT.D/MULTIPATHD Start

# Chkconfig MULTIPATHD on

# fdisk–l ( able to view up to two multipath disks mounted

/dev/mapper/mpath1

/DEV/MAPPER/MPATH2}

Report:

Create a user logical volume.

# pvcreate/dev/mapper/mpath1

# vgcreate-s 256m datavg/dev/mapper/mpath1

# lvcreate--size 2000G--name lv_src vg_data

# MKFS.EXT4/DEV/MAPPER/VG_DATA-LV_SRC

# MKDIR/SRC

# mount-t EXT4/DEV/MAPPER/VG_DATA-LV_SRC/SRC

load Balancing test.

# CD/SRC

# dd If=/dev/zero of=test.img

# iostat 1

Device:tps blk_read/s BLK_WRTN/S

SDA 2020.00 8.00 466272.00 # Two lines have data transfer, the main main mode is working.

SDB 2024.00 0.00 368952.00 # If only one line transmits data, it is the primary standby mode.

SDC 0.00 0.00 0.00

dm-0 4044.00 8.00 834776.00 # The merged path, the data equals two bars.

Oracle Mount ASM

#/etc/init.d/oracleasm Configure

#/etc/init.d/oracleasm Enable

#/etc/init.d/oracleasm Createdisk vol1/dev/mapper/mpath1

#/etc/init.d/oracleasm Scandisks

#/etc/init.d/oracleasm Listdisks

# oracleasm Querydisk-p VOL1


This article from "Meteor Yu" blog, declined reproduced!

Simulate Linux dual-NIC dual IP for multipath multi-Path connection storage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.