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

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

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-6-8 08:36:54 | 显示全部楼层 |阅读模式
拓扑图如下::


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
wKiom1Vz_Q-CScWoAAJxgsFSPi0339.jpg
加载镜像完成.
下面配置草C1  其他PC的配置类似

wKioL1V0ALPhaDwvAAKhizNj3-Y209.jpg
注意C1在这里选择本地网卡,C2 C3 一定选择NET8
下面开始配置R1 R2  R3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
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上都要安装

配置如下:
wKioL1V0BjGQllhMAAE3sNLyqYk709.jpg
keepalived的配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[iyunv@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上的路由配置



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

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





运维网声明 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-74849-1-1.html 上篇帖子: EIGRP基本配置 下篇帖子: IS-IS协议和RIP协议的路由重分发详细过程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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