懂ni 发表于 2019-1-5 10:00:42

ospf+lvs+fullnat 配置部署纪要

  拓扑图如下::
  

  

http://s3.运维网.com/wyfs02/M02/6E/17/wKioL1Vz-rHj8hVEAAFeNImiajE214.jpg
  实验需求及目的:
  通过ospf路由自动宣告功能来宣布LVS的VIP地址:192.168.0.111 使C1计算机能够通过网络不间断的访问192.168.0.111提供的WEB 访问服务。
  实验结果:
  在C1段的计算机节点ping VIP地址192.168.0.111   重启C2或者C3 这时候发现VIP不会断。

  实验工具:
  用gns3来模拟网络,用c7200模拟路由器R1和R2, 用C3600来模拟三层交换r3.
  用VMware虚拟机来实现LVS 的loadblance调度 LVS1和LVS2
  实验配置过程:
  GNS3配置
  1.加载镜像,点击edit-->ios IMAGES and hypervisors
http://s3.运维网.com/wyfs02/M02/6E/1C/wKiom1Vz_Q-CScWoAAJxgsFSPi0339.jpg
  加载镜像完成.
  下面配置草C1其他PC的配置类似

  http://s3.运维网.com/wyfs02/M00/6E/17/wKioL1V0ALPhaDwvAAKhizNj3-Y209.jpg
  注意C1在这里选择本地网卡,C2 C3 一定选择NET8
  下面开始配置R1 R2R3
R1的配置如下:
Router#sh running-config
Building configuration...
Current configuration : 1062 bytes
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
hostname Router
boot-start-marker
boot-end-marker
no aaa new-model
resource policy
ip subnet-zero
ip cef
no ip dhcp use vrf connected
no ip ips deny-action ips-interface
interface FastEthernet0/0
ip address 6.6.6.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 1.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface Ethernet1/0
no ip address
shutdown
duplex half
!
interface Ethernet1/1
no ip address
shutdown
duplex half
!
interface Ethernet1/2
no ip address
shutdown
duplex half
!
interface Ethernet1/3
no ip address
shutdown
duplex half
!
router ospf 10
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 6.6.6.0 0.0.0.255 area 0
!
ip classless
no ip http server
no ip http secure-server
control-plane
gatekeeper
shutdown
line con 0
stopbits 1
line aux 0
line vty 0 4
end

R2的配置如下:
Router#sh running-config
Router#sh running-config
Building configuration...
Current configuration : 1062 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
ip subnet-zero
ip cef
!
!
no ip dhcp use vrf connected
!
!
no ip ips deny-action ips-interface
interface FastEthernet0/0
ip address 2.2.2.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 1.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface Ethernet1/0
no ip address
shutdown
duplex half
!
interface Ethernet1/1
no ip address
shutdown
duplex half
!
interface Ethernet1/2
no ip address
shutdown
duplex half
!
interface Ethernet1/3
no ip address
shutdown
duplex half
!
router ospf 10
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 2.2.2.0 0.0.0.255 area 0
!
ip classless
no ip http server
no ip http secure-server
control-plane
gatekeeper
shutdown
line con 0
stopbits 1
line aux 0
line vty 0 4
!
!
end
#########################################################
R3的配置(三层交换的配置)
Router#sh running-config
Building configuration...
Current configuration : 1326 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
no aaa new-model
memory-size iomem 5
ip cef
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
interface FastEthernet0/0
no switchport
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/1
switchport access vlan 2
!
interface FastEthernet0/2
switchport access vlan 2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
no ip address
!
interface Vlan2
ip address 3.3.3.1 255.255.255.0
!
router ospf 10
log-adjacency-changes
network 2.2.2.0 0.0.0.255 area 0
network 3.3.3.0 0.0.0.255 area 0
!
no ip http server
no ip http secure-server
!
ip forward-protocol nd
!
!
mac-address-table static cc03.04c0.0000 interface FastEthernet0/2 vlan 1
control-plane
line con 0
line aux 0
line vty 0 4
login
end

分别查看R1R2   R3上的路由信息
R1:
Router#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
   1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, FastEthernet0/1
   2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0 via 1.1.1.1, 01:26:44, FastEthernet0/1
   3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 via 1.1.1.1, 01:26:44, FastEthernet0/1
   6.0.0.0/24 is subnetted, 1 subnets
C       6.6.6.0 is directly connected, FastEthernet0/0
   192.168.0.0/32 is subnetted, 1 subnets
O       192.168.0.111 via 1.1.1.1, 01:26:44, FastEthernet0/1
R2:
Router#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
   1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, FastEthernet0/1
   2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, FastEthernet0/0
   3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 via 2.2.2.2, 01:27:12, FastEthernet0/0
   6.0.0.0/24 is subnetted, 1 subnets
O       6.6.6.0 via 1.1.1.2, 01:27:12, FastEthernet0/1
   192.168.0.0/32 is subnetted, 1 subnets
O       192.168.0.111 via 2.2.2.2, 01:27:12, FastEthernet0/0
R3:
Router#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
   1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0 via 2.2.2.1, 01:25:40, FastEthernet0/0
   2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, FastEthernet0/0
   3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Vlan2
   6.0.0.0/24 is subnetted, 1 subnets
O       6.6.6.0 via 2.2.2.1, 01:25:40, FastEthernet0/0
   192.168.0.0/32 is subnetted, 1 subnets
O       192.168.0.111 via 3.3.3.8, 01:25:40, Vlan2
                      via 3.3.3.3, 01:25:42, Vlan2  下面是虚拟机的配置
  虚拟机LVS1和2需要两个网卡1个走NET8模式一个走桥接模式
  虚拟机首先安装quagga 包
  yum -y install quaggakeepalived ipvsadm
  LVS1和LVS2上都要安装

  配置如下:
http://s3.运维网.com/wyfs02/M01/6E/18/wKioL1V0BjGQllhMAAE3sNLyqYk709.jpg
  keepalived的配置:
# cat/etc/keepalived/keepalived.conf
vrrp_instance VI_2 {
    interface eth3
    virtual_router_id 11
    priority 30
    virtual_ipaddress {
      192.168.0.111
    }
}
virtual_server 192.168.0.111 80 {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP
    real_server 192.168.0.109 80 {
      weight 10
      inhibit_on_failure
      TCP_CHECK {
      connect_timeout 9
      nb_get_retry 3
      delay_before_retry 3
      connect_port 80
      }
    }
}
查看服务器上LV1或LVS2上的路由配置http://s3.运维网.com/wyfs02/M01/6E/1C/wKiom1V0Cnbi3qm-AAEdPq1Zw44007.jpg
  最后 在拿一台电脑模仿PC客户端, 配置IP 6.6.6.3指定网管为6.6.6.2(R1的接口IP)
  然后在该机器上ping192.168.0.111       重启lvs1 或者LV2VIP也不会断。
  达到实验目的!!!
  

  当然在起个虚拟机模仿也是可以的

  

  

  GNS3 OSPF路由配置参考
  http://www.bearmr.com/index.php/l3/
  




页: [1]
查看完整版本: ospf+lvs+fullnat 配置部署纪要