赞
踩
[sw1]interface Bridge-Aggregation 1
[sw1]interface range GigabitEthernet 1/0/1 GigabitEthernet 1/0/2
[sw1-if-range]port link-aggregation group 1
[sw2]interface Bridge-Aggregation 1
[sw2]interface range GigabitEthernet 1/0/1 GigabitEthernet 1/0/2
[sw2-if-range]port link-aggregation group 1
[sw1]display link-aggregation verbose
[sw1]vlan 10 // A流
[sw1-vlan10]vlan 20 // B流
[sw1-vlan20]vlan 30 // 互联接口地址
[sw1-vlan30]vlan 40 // G1/0/4
[sw1-vlan40]port GigabitEthernet 1/0/4
[sw2]vlan 10
[sw2-vlan10]vlan 20
[sw2-vlan20]vlan 30
[sw2-vlan30]vlan 40
[sw2-vlan40]port GigabitEthernet 1/0/4
[sw3]vlan 10
[sw3-vlan10]vlan 20
[sw1]interface GigabitEthernet 1/0/3
[sw1-GigabitEthernet1/0/3]port link-type trunk
[sw1-GigabitEthernet1/0/3]port trunk permit vlan 10 20
[sw1-GigabitEthernet1/0/3]undo port trunk permit vlan 1
[sw1]interface bridge-aggregation 1
[sw1-Bridge-Aggregation1]port link-type trunk
[sw1-Bridge-Aggregation1]port trunk permit vlan 10 20 30
[sw1-Bridge-Aggregation1]undo port trunk permit vlan 1
[sw2]interface GigabitEthernet1/0/3
[sw2-GigabitEthernet1/0/3] port link-type trunk
[sw2-GigabitEthernet1/0/3] port trunk permit vlan 10 20
[sw2-GigabitEthernet1/0/3]undo port trunk permit vlan 1
[sw2]interface Bridge-Aggregation1
[sw2-Bridge-Aggregation1] port link-type trunk
[sw2-Bridge-Aggregation1] port trunk permit vlan 10 20 30
[sw2-Bridge-Aggregation1]undo port trunk permit vlan 1
[sw3]interface range GigabitEthernet 1/0/1 GigabitEthernet 1/0/2
[sw3-if-range]port link-type trunk
[sw3-if-range]port trunk permit vlan 10 20
[sw3-if-range]undo port trunk permit vlan 1
[sw1]display port trunk
[sw1]stp region-configuration
[sw1-mst-region]region-name h3c
[sw1-mst-region]revision-level 3 // 修订级可做可不做。要做都做,一方做一方不做会导致多域
[sw1-mst-region]instance 1 vlan 10
[sw1-mst-region]instance 2 vlan 20
[sw1-mst-region]active region-configuration
[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary
[sw2]stp region-configuration
[sw2-mst-region] region-name h3c
[sw2-mst-region] revision-level 3
[sw2-mst-region] instance 1 vlan 10
[sw2-mst-region] instance 2 vlan 20
[sw2-mst-region] active region-configuration
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primary
[sw3]stp region-configuration
[sw3-mst-region] region-name h3c
[sw3-mst-region] revision-level 3
[sw3-mst-region] instance 1 vlan 10
[sw3-mst-region] instance 2 vlan 20
[sw3-mst-region] active region-configuration
<sw3>display stp instance 1 brief
[sw1]interface Vlan-interface 10
[sw1-Vlan-interface10]ip address 192.168.0.253 24
[sw1-Vlan-interface10]vrrp vrid 10 virtual-ip 192.168.0.254
[sw1-Vlan-interface10]vrrp vrid 10 priority 120
[sw1]interface Vlan-interface 20
[sw1-Vlan-interface20]ip address 10.1.255.253 16
[sw1-Vlan-interface20]vrrp vrid 20 virtual-ip 10.1.255.254
[sw2]interface Vlan-interface 10
[sw2-Vlan-interface10]ip address 192.168.0.252 24
[sw2-Vlan-interface10]vrrp vrid 10 virtual-ip 192.168.0.254
[sw2]interface vlan-interface 20
[sw2-Vlan-interface20]ip address 10.1.255.252 16
[sw2-Vlan-interface20]vrrp vrid 20 virtual-ip 10.1.255.254
[sw2-Vlan-interface20]vrrp vrid 20 priority 120
[sw3]interface Vlan-interface 10
[sw3-Vlan-interface10]ip address 192.168.0.1 24
[sw3]interface Vlan-interface 20
[sw3-Vlan-interface20]ip address 10.1.1.100 16
<sw1>display vrrp
[sw1]interface Vlan-interface 30
[sw1-Vlan-interface30]ip address 10.255.212.1 30
[sw1]interface vlan-interface 40
[sw1-Vlan-interface40]ip address 10.255.111.1 30
[sw1]interface LoopBack 0
[sw1-LoopBack0]ip address 192.168.255.11 32
[sw2]interface vlan-interface 30
[sw2-Vlan-interface30]ip address 10.255.212.2 30
[sw2]interface vlan-interface 40
[sw2-Vlan-interface40]ip address 10.255.122.1 30
[sw2]interface LoopBack 0
[sw2-LoopBack0]ip address 192.168.255.12 32
[r1]interface GigabitEthernet 0/0
[r1-GigabitEthernet0/0]ip address 10.255.111.2 30
[r1]interface GigabitEthernet 0/1
[r1-GigabitEthernet0/1]ip address 10.255.12.1 30
[r1]interface GigabitEthernet 0/2
[r1-GigabitEthernet0/2]ip address 100.1.1.1 24
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.255.1 32
[r2]interface GigabitEthernet 0/0
[r2-GigabitEthernet0/0]ip address 10.255.122.2 30
[r2]interface GigabitEthernet 0/1
[r2-GigabitEthernet0/1]ip address 10.255.12.2 30
[r2]interface Serial 1/0
[r2-Serial1/0]ip address 10.255.25.1 30
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.255.2 30
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.255.3 32
[r3]interface LoopBack 100
[r3-LoopBack100]ip address 192.168.101.1 24 // a流
[r3]interface LoopBack 200
[r3-LoopBack200]ip address 10.101.1.1 24 // b流
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.255.4 32
[r4]interface LoopBack 100
[r4-LoopBack100]ip address 192.168.102.1 24
[r4]interface LoopBack 200
[r4-LoopBack200]ip address 10.101.2.1 24
[r5]interface Serial 1/0
[r5-Serial1/0]ip address 10.255.25.2 30
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.255.5 32
[r5]interface GigabitEthernet 0/0.10
[r5-GigabitEthernet0/0.10]ip address 192.168.11.254 24
[r5-GigabitEthernet0/0.10]vlan-type dot1q vid 10
[r5]interface GigabitEthernet 0/0.20
[r5-GigabitEthernet0/0.20]ip address 10.11.0.254 16
[r5-GigabitEthernet0/0.20]vlan-type dot1q vid 20
[sw4]vlan 10
[sw4-vlan10]interface vlan-interface 10
[sw4-Vlan-interface10]ip address 192.168.11.1 24
[sw4]vlan 20
[sw4-vlan20]interface vlan-interface 20
[sw4-Vlan-interface20]ip address 10.11.0.1 16
[sw4]interface GigabitEthernet 1/0/1
[sw4-GigabitEthernet1/0/1]port link-type trunk
[sw4-GigabitEthernet1/0/1]port trunk permit vlan 10 20
[sw5]vlan 10
[sw5-vlan10]port GigabitEthernet 1/0/1
[sw5]interface Vlan-interface 10
[sw5-Vlan-interface10]ip address 100.1.1.254 24
[sw5]vlan 20
[sw5-vlan20]port GigabitEthernet 1/0/2
[sw5]interface Vlan-interface 20
[sw5-Vlan-interface20]ip address 100.1.3.254 24
[sw5]vlan 30
[sw5-vlan30]port GigabitEthernet 1/0/3
[sw5]interface Vlan-interface 30
[sw5-Vlan-interface30]ip address 100.1.4.254 24
[sw5]dhcp enable
[sw5]dhcp server ip-pool vlan20
[sw5-dhcp-pool-vlan20]network 100.1.3.0 24
[sw5-dhcp-pool-vlan20]gateway-list 100.1.3.254
[sw5]dhcp server ip-pool vlan30
[sw5-dhcp-pool-vlan30]network 100.1.4.0 24
[sw5-dhcp-pool-vlan30]gateway-list 100.1.4.254
[r3]interface GigabitEthernet 0/0
[r3-GigabitEthernet0/0]ip address dhcp-alloc
[r4]interface GigabitEthernet 0/0
[r4-GigabitEthernet0/0]ip address dhcp-alloc
<r3>display interface brief
注:DHCP自动分配后,会自动生产一条默认路由,优先级为70。
[r2]local-user r5 class network
[r2-luser-network-r5]password simple 123
[r2-luser-network-r5]service-type ppp
[r5]local-user r2 class network
[r5-luser-network-r2]password simple 123
[r5-luser-network-r2]service-type ppp
[r2]interface Serial 1/0
[r2-Serial1/0]ppp authentication-mode chap
[r2-Serial1/0]ppp chap user r2
[r2-Serial1/0]ppp chap password simple 123
[r5]interface Serial 1/0
[r5-Serial1/0]ppp authentication-mode chap
[r5-Serial1/0]ppp chap user r5
[r5-Serial1/0]ppp chap password simple 123
[r2-Serial1/0] shutdown
[r2-Serial1/0]undo shutdown
[sw1]ospf 1 router-id 192.168.255.11
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 192.168.255.11 0.0.0.0
[sw1-ospf-1-area-0.0.0.0]network 192.168.0.253 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]network 10.1.255.253 0.0.255.255
[sw1-ospf-1-area-0.0.0.0]network 10.255.212.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.0]network 10.255.111.1 0.0.0.0
[sw2]ospf 1 router-id 192.168.255.12
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 192.168.255.12 0.0.0.0
[sw2-ospf-1-area-0.0.0.0]network 192.168.0.252 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]network 10.1.255.252 0.0.255.255
[sw2-ospf-1-area-0.0.0.0]network 10.255.212.2 0.0.0.0
[sw2-ospf-1-area-0.0.0.0]network 10.255.122.1 0.0.0.0
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.255.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 10.255.111.2 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 10.255.12.1 0.0.0.0
[r2]ospf 1 router-id 192.168.255.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.255.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.255.122.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.255.12.2 0.0.0.0
[r2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]network 10.255.25.1 0.0.0.0
[r5]ospf 1 router-id 192.168.255.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.255.5 0.0.0.0
[r5-ospf-1-area-0.0.0.1]network 192.168.11.254 0.0.0.255
[r5-ospf-1-area-0.0.0.1]network 10.11.0.254 0.0.255.255
[r5-ospf-1-area-0.0.0.1]network 10.255.25.2 0.0.0.0
但是用sw4 ping 总部a流 192.168.0.252 不可通,默认路由未配置,配置默认路由后可通。
[sw4]ip route-static 0.0.0.0 0 192.168.11.254
[r1]ip route-static 0.0.0.0 0 100.1.1.254
[r1]ike proposal 1
[r1]ike keychain r3
[r1-ike-keychain-r3]pre-shared-key hostname r3 key simple 123
[r1]ike profile r3
[r1-ike-profile-r3]exchange-mode aggressive
[r1-ike-profile-r3]local-identity fqdn r1
[r1-ike-profile-r3]match remote identity fqdn r3
[r1-ike-profile-r3]proposal 1
[r1-ike-profile-r3]keychain r3
[r1]ike keychain r4
[r1-ike-keychain-r4]pre-shared-key hostname r4 key simple 123
[r1]ike profile r4
[r1-ike-profile-r4] exchange-mode aggressive
[r1-ike-profile-r4] local-identity fqdn r1
[r1-ike-profile-r4] match remote identity fqdn r4
[r1-ike-profile-r4] proposal 1
[r1-ike-profile-r4] keychain r4
[r1]ipsec transform-set tran1
[r1-ipsec-transform-set-tran1]esp authentication-algorithm md5
[r1-ipsec-transform-set-tran1]esp encryption-algorithm 3des-cbc
[r1]ipsec policy-template tem 3
[r1-ipsec-policy-template-tem-3]ike-profile r3
[r1-ipsec-policy-template-tem-3]transform-set tran1
[r1]ipsec policy-template tem 4
[r1-ipsec-policy-template-tem-4]ike-profile r4
[r1-ipsec-policy-template-tem-4]transform-set tran1
[r1]ipsec policy H3C 1 isakmp template tem
[r1]interface GigabitEthernet 0/2
[r1-GigabitEthernet0/2]ipsec apply policy H3C
[r3]acl advanced 3000
[r3-acl-ipv4-adv-3000]rule permit ip source 192.168.255.3 0 destination 192.168.255.1 0
[r3]ike proposal 1
[r3]ike keychain r1
[r3-ike-keychain-r1]pre-shared-key address 100.1.1.1 key simple 123
[r3]ike profile r1
[r3-ike-profile-r1] exchange-mode aggressive
[r3-ike-profile-r1] local-identity fqdn r3
[r3-ike-profile-r1] match remote identity fqdn r1
[r3-ike-profile-r1] proposal 1
[r3-ike-profile-r1] keychain r1
[r3]ipsec transform-set tran1
[r3-ipsec-transform-set-tran1]esp authentication-algorithm md5
[r3-ipsec-transform-set-tran1]esp encryption-algorithm 3des-cbc
[r3]ipsec policy H3C 1 isakmp
[r3-ipsec-policy-isakmp-H3C-1]security acl 3000
[r3-ipsec-policy-isakmp-H3C-1]remote-address 100.1.1.1
[r3-ipsec-policy-isakmp-H3C-1]ike-profile r1
[r3-ipsec-policy-isakmp-H3C-1]transform-set tran1
[r3]interface GigabitEthernet 0/0
[r3-GigabitEthernet0/0]ipsec apply policy H3C
[r4]acl advanced 3000
[r4-acl-ipv4-adv-3000]rule permit ip source 192.168.255.4 0 destination 192.168.255.1 0
[r4]ike proposal 1
[r4]ike keychain r1
[r4-ike-keychain-r1]pre-shared-key address 100.1.1.1 key simple 123
[r4]ike profile r1
[r4-ike-profile-r1] exchange-mode aggressive
[r4-ike-profile-r1] local-identity fqdn r4
[r4-ike-profile-r1] match remote identity fqdn r1
[r4-ike-profile-r1] proposal 1
[r4-ike-profile-r1] keychain r1
[r4]ipsec transform-set tran1
[r4-ipsec-transform-set-tran1]esp authentication-algorithm md5
[r4-ipsec-transform-set-tran1]esp encryption-algorithm 3des-cbc
[r4]ipsec policy H3C 1 isakmp
[r4-ipsec-policy-isakmp-H3C-1]security acl 3000
[r4-ipsec-policy-isakmp-H3C-1]remote-address 100.1.1.1
[r4-ipsec-policy-isakmp-H3C-1]ike-profile r1
[r4-ipsec-policy-isakmp-H3C-1]transform-set tran1
[r4]interface GigabitEthernet 0/0
[r4-GigabitEthernet0/0]ipsec apply policy H3C
[r1]display ike sa
[r1]display ipsec sa brief
3. 分支 ping 总部 可通
注:少配漏配后补全无法 ping 通,用reset ike sa,reset ipsec sa清除重新触发sa
[r1]interface Tunnel 0 mode gre
[r1-Tunnel0]ip address 10.255.13.1 30
[r1-Tunnel0]source LoopBack 0
[r1-Tunnel0]destination 192.168.255.3
[r1-Tunnel0]keepalive
[r1]interface Tunnel 1 mode gre
[r1-Tunnel1]ip address 10.255.14.1 30
[r1-Tunnel1]source LoopBack 0
[r1-Tunnel1]destination 192.168.255.4
[r1-Tunnel1]keepalive
[r3]interface Tunnel 1 mode gre
[r3-Tunnel1]ip address 10.255.13.2 30
[r3-Tunnel1]source LoopBack 0
[r3-Tunnel1]destination 192.168.255.1
[r3-Tunnel1]keepalive
[r4]interface Tunnel 1 mode gre
[r4-Tunnel1]ip address 10.255.14.2 30
[r4-Tunnel1]source LoopBack 0
[r4-Tunnel1]destination 192.168.255.1
[r4-Tunnel1]keepalive
[r1]rip
[r1-rip-1]version 2
[r1-rip-1]undo summary
[r1-rip-1]network 10.0.0.0
[r3]rip
[r3-rip-1]version 2
[r3-rip-1]undo summary
[r3-rip-1]network 10.0.0.0
[r3-rip-1]network 192.168.101.0
[r4]rip
[r4-rip-1]version 2
[r4-rip-1]undo summary
[r4-rip-1]network 10.0.0.0
[r4-rip-1]network 192.168.102.0
[r1]display ip routing-table protocol rip
[r1]ip prefix-list o2r permit 192.168.0.0 24
[r1]ip prefix-list o2r permit 10.0.0.0 8 greater-equal 16 less-equal 24
[r1]ip prefix-list o2r permit 10.0.0.0 8 greater-equal 32
[r1]route-policy o2r permit node 10
[r1-route-policy-o2r-10]if-match ip address prefix-list o2r
[r1]rip
[r1-rip-1]import-route ospf route-policy o2r
<r3>display ip routing-table protocol rip
[r1]ip prefix-list r2o permit 192.168.64.0 18 less-equal 32
[r1]ip prefix-list r2o permit 10.101.0.0 16 less-equal 32
[r1]route-policy r2o permit node 10
[r1-route-policy-r2o-10]if-match ip address prefix-list r2o
[r1]ospf
[r1-ospf-1]import-route rip route-policy r2o
<sw1>display ip routing-table protocol ospf
[r5]acl basic 2000
[r5-acl-ipv4-basic-2000]rule permit source 192.168.0.0 0.0.0.255
[r5-acl-ipv4-basic-2000]rule permit source 10.1.0.0 0.0.255.255
[r5-acl-ipv4-basic-2000]rule permit source 10.101.0.0 0.0.255.255
[r5]ospf
[r5-ospf-1]filter-policy 2000 import
[r5]display ip routing-table protocol ospf
[r3]acl basic 2000
[r3-acl-ipv4-basic-2000]rule deny source 192.168.102.0 0.0.0.255
[r3-acl-ipv4-basic-2000]rule permit source any
[r3]rip
[r3-rip-1]filter-policy 2000 import
[r4]acl basic 2000
[r4-acl-ipv4-basic-2000]rule deny source 192.168.101.0 0.0.0.255
[r4-acl-ipv4-basic-2000]rule permit source any
[r4]rip
[r4-rip-1]filter-policy 2000 import
<r1>terminal debugging
The current terminal is enabled to display debugging logs.
<r1>terminal monitor
The current terminal is enabled to display logs.
[r1]rip
[r1-rip-1]silent-interface GigabitEthernet 0/0
[r1-rip-1]silent-interface GigabitEthernet 0/1
[sw1]ospf
[sw1-ospf-1]silent-interface Vlan-interface 10
[sw1-ospf-1]silent-interface Vlan-interface 20
[sw2]ospf
[sw2-ospf-1]silent-interface Vlan-interface 10
[sw2-ospf-1]silent-interface Vlan-interface 20
[r3]rip
[r3-rip-1]silent-interface LoopBack 100
[r3-rip-1]silent-interface LoopBack 200
[r4]rip
[r4-rip-1]silent-interface LoopBack 100
[r4-rip-1]silent-interface LoopBack 200
[r5]ospf
[r5-ospf-1]silent-interface GigabitEthernet 0/0.10
[r5-ospf-1]silent-interface GigabitEthernet 0/0.20
[sw1]interface Vlan-interface 30
[sw1-Vlan-interface30]ospf cost 1000
[sw2]interface Vlan-interface 30
[sw2-Vlan-interface30]ospf cost 1000
3.检查
cost更改前后路由如下:
1.引入默认路由
[r1]ospf
[r1-ospf-1]default-route-advertise
[r1]acl basic 2001
[r1-acl-ipv4-basic-2001]rule permit source 10.1.0.0 0.0.255.255
[r1]interface GigabitEthernet 0/2
[r1-GigabitEthernet0/2]nat outbound 2001
[r3]acl basic 2001
[r3-acl-ipv4-basic-2001]rule permit source 10.101.1.0 0.0.0.255
[r3]interface GigabitEthernet 0/0
[r3-GigabitEthernet0/0]nat outbound 2001
[r4]acl basic 2001
[r4-acl-ipv4-basic-2001]rule permit source 10.101.2.0 0.0.0.255
[r4]interface GigabitEthernet 0/0
[r4-GigabitEthernet0/0]nat outbound 2001
[sw3]ip route-static 0.0.0.0 0 192.168.0.254
[sw3]ip route-static 0.0.0.0 0 10.1.255.254
[r1]nat static outbound 10.1.1.100 100.1.1.100
[r1]interface GigabitEthernet 0/2
[r1-GigabitEthernet0/2]nat static enable
[r2]acl advanced 3000
[r2-acl-ipv4-adv-3000]rule permit ip source 192.168.0.0 0.0.0.255 destination 192.168.11.0 0.0.0.255
[r2]traffic classifier a
[r2-classifier-a]if-match acl 3000
[r2]traffic behavior a
[r2-behavior-a]queue af bandwidth 1500
[r2]qos policy a
[r2-qospolicy-a]classifier a behavior a
[r2]interface Serial 1/0
[r2-Serial1/0]bandwidth 2048
[r2-Serial1/0]qos apply policy a outbound
<r1>display qos policy interface Serial 1/0
7. 在r5上做同样配置
[r5]acl advanced 3000
[r5-acl-ipv4-adv-3000]rule permit ip source 192.168.11.0 0.0.0.255 destination 192.168.0.0 0.0.0.255
[r1]acl basic 2002
[r1-acl-ipv4-basic-2002]rule permit source 192.168.0.100 0
[r1]undo password-control enable
[r1]undo password-control length enable
[r1]undo password-control complexity user-name check
[r1]undo password-control change-password weak-password enable
[r1]undo password-control composition enable
[r1]telnet server enable
[r1]local-user abc
[r1-luser-manage-abc]password simple 123
[r1-luser-manage-abc]service-type telnet
[r1-luser-manage-abc]authorization-attribute user-role level-15
[r1]line vty 0 63
[r1-line-vty0-63]authentication-mode scheme
[r1]telnet server acl 2002
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。