目录
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 
1.    PC1 PC2(真实机)分别加入vlan2vlan3

2.    SW1 SW2之间实现负载和冗余

3.    R1 R2模拟两台ISP的路由器,并且做ppp认证

4.    正常情况下PC1SW1出外网,PC2SW2出外网

PC1 IP-<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />1.1.1.1/24  default-gateway-1.1.1.254

PC2: IP-2.2.2.1/24  default-gateway-2.2.2.254

SW1:vlan2-1.1.1.100/24  vlan3-2.2.2.200/24  F1/5-11.11.11.10/24

SW2:vlan2-1.1.1.200/24  vlan3-2.2.2.100/24  F1/5-22.22.22.20/24

R1: F0/0-11.11.11.11/24   S1/0-12.12.12.1/24

R2: F0/0-22.22.22.22/24   S1/0-12.12.12.2/24

1. SW1SW2之间做以太通道

interface range f1/1 2

channel-group 1 mode on

以太通道完成!!!

2. 配置vlan信息以及trunk链路

SW2

vlan database

vtp domain aa

vtp server

vlan 2

vlan 3

exit

configure terminal

interface port-channel 1

switchport mode trunk

exit

interface f1/3

switchport mode trunk

end

VTP server 成功完成!!!

两个接口都成为了trunk接口

查看一下vlantrunk信息

Vlan2 vlan3策划成功建立

接口port-channel 1F1/3状态为trunking

SW1

vlan database

vtp domain aa

vtp client

exit

configure terminal

interface port-channel 1

switchport mode trunk

exit

interafec f1/3

switchport mode trunk

end

查看vlan信息

Vlan2 vlan3成功传递过来

SW3

vlan database

vtp domain aa

vtp client

exit

configure terminal

interface range f1/1 2

switchport mode trunk

end

查看vlan信息

Vlan 信息也传过来了

3. 解决交换环路,实现链路全部负载

首先查看交换机中的vlan信息,阻塞端口信息

在三个vlan中阻塞的端口都是SW3F1/2,这样PVST虽然运行了,好像没有起到作用,造成了链路的浪费,所以要在不通的vlan中指定不同的根桥,具体操作如下:

vlan2中指定SW1为主根,SW2为辅助根,在vlan3中指定SW2为主根,SW1为辅助根

SW1

spanning-tree vlan 2 root primary

spanning-tree vlan 3 toot secondary

SW2

spanning-tree vlan 3 root primary

spanning-tree vlan 2 toot secondary

现在查看阻塞端口的信息(在SW3上面查看)

可以看出在vlan1vlan2 中阻塞的端口是SW3F1/2,在vlan3中的阻塞端口为SW3F1/1

这样以来在每个vlan中阻塞不通的端口,就实现了线路的全部负载,不会导致链路的浪费

4. 配置PC1PC2,并把直连接口分别加入vlan2vlan3

PC1

interface f0/0

ip add 1.1.1.1 255.255.255.0

no shut

ip default-gateway 1.1.1.254

PC2

interface f0/0

ip add 2.2.2.1 255.255.255.0

no shut

ip default-gateway 2.2.2.254

SW3

interface f1/11

switchport mode access

switchport access vlan 2

end

interface f1/12

switchport mode access

switchport access vlan 3

end

查看vlan信息

两个接口成功加入对应的vlan

5. 配置SW1SW2,实现hsrp双备份,并开启端口追踪

SW1

interface vlan 2

ip add 1.1.1.100 255.255.255.0

no shut

interface vlan 3

ip add 2.2.2.200 255.255.255.0

no shut

interface f1/5

no switchport

ip add 11.11.11.10 255.255.255.0

no shut

exit

interface vlan 2

standby 2 ip 1.1.1.254

standby 2 priority 150

standby 2 preempt

standby 2 track f1/5 100

exit

interface vlan 3

standby 3 ip 2.2.2.254

standby 3 priority 120

standby 3 preempt

end

SW2

interface vlan 2

ip add 1.1.1.200 255.255.255.0

no shut

interface vlan 3

ip add 2.2.2.100 255.255.255.0

no shut

interface f1/5

no switchport

ip add 22.22.22.20 255.255.255.0

no shut

exit

interface vlan 2

standby 2 ip 1.1.1.254

standby 2 priority 120

standby 2 preempt

exit

interface vlan 3

standby 3 ip 2.2.2.254

standby 3 priority 150

standby 3 preempt

standby 3 track f1/5 100

end

查看抢占信息

vlan2SW1activeSW2standby,在vlan3SW2activeSW1standby

在两台PC上面ping一下对方,查看路径

PC1 经过SW1-SW2到达了PC2,走的是左边

PC2 经过SW2-SW1到达了PC1,走的是右边

6. 配置R1R2

R1

interface s1/0

ip add 12.12.12.1 255.255.255.0

no shut

interface f0/0

ip add 11.11.11.11 255.255.255.0

no shut

interface lo1

ip add 100.100.100.100 255.255.255.0

exit

router rip

version 2

no auto-summary

net 12.0.0.0

net 11.0.0.0

net 100.0.0.0

end

R2

interface s1/0

ip add 12.12.12.2 255.255.255.0

no shut

interface f0/0

ip add 22.22.22.22 255.255.255.0

no shut

interface lo1

ip add 200.200.200.200 255.255.255.0

exit

router rip

version 2

no auto-summary

net 12.0.0.0

net 22.0.0.0

net 200.200.200.0

end

查看路由表

正常!!!

现在在PC1上面测试区pingR1上面的11.11.11.11

拼不通,这个问题要用下面的方法解决

7. SW1SW2上面做NAT和默认路由使PC能够访问路由器的直连接口和环回接口

SW1

access-list 1 permit 1.1.1.0 0.0.0.255

access-list 1 permit 2.2.2.0 0.0.0.255

ip nat inside source list 1 interface f1/5 overload

interface f1/5

ip nat outside

interface vlan 2

ip nat inside

interface vlan 3

ip nat inside

end

现在再测试一下

可以正常通讯

ping一下上面的环回口

目标主机不可达,因为在路由表中没有将该数据送出去的条目

这时要用默认路由解决,将所有不知道的流量通过F1/5接口送出去

ip route 0.0.0.0 0.0.0.0 f1/5

end

现在再ping就会通了

SW2上面同理也要这样做

SW2

access-list 1 permit 1.1.1.0 0.0.0.255

access-list 1 permit 2.2.2.0 0.0.0.255

ip nat inside source list 1 interface f1/5 overload

interface f1/5

ip nat outside

interface vlan 2

ip nat inside

interface vlan 3

ip nat inside

exit

ip route 0.0.0.0 0.0.0.0 f1/5

end

现在在PC1上面测试ping100.100.100.100走的路径

流量是通过SW1-R1到达100.100.100.100

SW1F1/5接口宕掉的话,查看PC1ping100.100.100.100走的路径

SW1 上面的vlan2变为了standby

现在测试

很明显走的是SW2-R2-R1,走的右边

当接口F1/5起来的时候,SW1会重新变为active,并且在测试时会走左边(端口追踪)

又恢复了正常,同理在PC2上面的情况和PC1上面一样

8. R1R2上面做pap双向认证

R1

username aa password 123

interface s1/0

encapsulation ppp

ppp authentication pap

接口当掉了,查看R1R2的路由表,只剩下直连条目了

现在要配置R2上面的S1/0接口,发送用户名和密码

R2

interface s1/0

encapsulation ppp

ppp pap sent-username aa passwod 123

接口起来了

查看路由表

正常!!!

现在在R2上面启用pap认证

R2

username bb password 123

interface s1/0

ppp authentication pap

end

接口又宕掉了

还是和之前一样只剩下直连路由条目

R1上面发送用户名和密码

R2

interface s1/0

ppp pap sent-username bb password 123

end

都正常了!!!