设为首页 收藏本站
查看: 1024|回复: 0

[经验分享] ospf+lvs+fullnat 配置部署纪要

[复制链接]

尚未签到

发表于 2019-1-5 10:00:42 | 显示全部楼层 |阅读模式
  拓扑图如下::
  

  


  实验需求及目的:
  通过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

  加载镜像完成.
  下面配置草C1  其他PC的配置类似

  
  注意C1在这里选择本地网卡,C2 C3 一定选择NET8
  下面开始配置R1 R2  R3
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

分别查看R1  R2   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 [110/2] via 1.1.1.1, 01:26:44, FastEthernet0/1
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 [110/3] 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 [110/13] 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 [110/2] via 2.2.2.2, 01:27:12, FastEthernet0/0
     6.0.0.0/24 is subnetted, 1 subnets
O       6.6.6.0 [110/2] via 1.1.1.2, 01:27:12, FastEthernet0/1
     192.168.0.0/32 is subnetted, 1 subnets
O       192.168.0.111 [110/12] 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 [110/2] 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 [110/3] via 2.2.2.1, 01:25:40, FastEthernet0/0
     192.168.0.0/32 is subnetted, 1 subnets
O       192.168.0.111 [110/11] via 3.3.3.8, 01:25:40, Vlan2
                      [110/11] via 3.3.3.3, 01:25:42, Vlan2  下面是虚拟机的配置
  虚拟机LVS1和2需要两个网卡  1个走NET8模式  一个走桥接模式
  虚拟机首先安装quagga 包
  yum -y install quagga  keepalived ipvsadm
  LVS1和LVS2上都要安装

  配置如下:

  keepalived的配置:
[root@lvs-1 ~]# 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上的路由配置

  最后 在拿一台电脑模仿PC客户端, 配置IP 6.6.6.3  指定网管为6.6.6.2(R1的接口IP)
  然后在该机器上ping  192.168.0.111       重启lvs1 或者LV2  VIP也不会断。
  达到实验目的!!!
  

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

  

  

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





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-659551-1-1.html 上篇帖子: LVS(Linux 虚拟服务)NAT模式配置详解 下篇帖子: lvs负载均衡, ipvs的NAT模式,DR模式的实现,
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表