sys
sysname sw1/sw2/sw3/sw4
undo in en
vlan batch 10 20 30 40
int e0/0/1
port link-type access
port default vlan 10/20/30/40, (sw4 int e0/0/2加入vlan40)
display vlan
display ip interface brief
display ip routing-table
display ip routing-table | include /24
display acl all
display this
display vrrp brief
display version
display current-configuration
为sw1/2/3/4配置GE0/0/1 GE0/0/2为中继链路
interface GigabitEthernet 0/0/1
port link-type trunk
port trunk allow-pass vlan all
interface GigabitEthernet 0/0/2
port link-type trunk
port trunk allow-pass vlan all
display vlan
10 common UT:Eth0/0/1(U)TG:GE0/0/1(D) GE0/0/2(D)
20 common TG:GE0/0/1(D) GE0/0/2(D)
30 common TG:GE0/0/1(D) GE0/0/2(D)
40 common TG:GE0/0/1(D) GE0/0/2(D)
如果接口配置混乱,可以还原
[sw1]clear configuration interface GigabitEthernet 0/0/1
[sw1]in g0/0/1
[sw1-GigabitEthernet0/0/1]undo shutdown
三层交换机
sys
undo in en
vlan batch 10 20 30 40 50
sys sw5/sw6
port-group 1
group-member g0/0/1 to g0/0/4
port link-type trunk
port trunk allow-pass vlan all
display vlan
192.168.1.100/29=255.255.255.248求网络地址、主机地址和广播地址
128 64 32 16 8 4 2 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
192.168.1.50/28=255.255.255.240求网络地址、主机地址和广播地址
c类网络24,借了4位,可以划分出2^4=16个子网,每个子网可以容纳2^(8-4)-2=14台主机
块=2^4(主机位数)=16
16的倍数最接近50的为48
所以:
网络地址:192.168.1.48/28
主机地址:192.168.1.49--192.168.1.62
广播地址:192.168.1.63
例4:子网划分相关面试题
第一问:61.179.150.39/28 子网号为多少?广播号为多少?可用IP地址范围是多少?
解:块=2^4=16
16的倍数最接近39的为=32
所以:子网号为:61.179.150.32/28
广播号为:61.179.150.47/28
可用IP地址范围:61.179.150.33~61.179.150.46
61.179.150.88 /29 子网号为多少?广播号为多少?可用IP地址范围是多少?
块=2^5=32,可用主机数=2^(8-5)-2=6
32的倍数最接近88的为64
所以子网号为:61.179.150.64/29
广播号为:61.179.150.95/29 64+32-1
可用IP地址范围:61.179.150.89-61.179.150.94
创建链路聚合,将两条线路捆绑当作一条线路
[sw5]in eth-trunk 1
[sw5-Eth-Trunk1]trunkport GigabitEthernet 0/0/5 0/0/6
[sw5-Eth-Trunk1]port link-type trunk 配置为中继链路
[sw5-Eth-Trunk1]port trunk allow-pass vlan all 放行所有
[sw6]in eth-trunk 1
[sw6-Eth-Trunk1]trunkport GigabitEthernet 0/0/5 0/0/6
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw6-Eth-Trunk1]port link-type trunk
[sw6-Eth-Trunk1]port trunk allow-pass vlan all
[sw5]int vlan 10
[sw5-Vlanif10]ip add 192.168.10.252 24
[sw5-Vlanif10]int vlan 20
[sw5-Vlanif20]ip add 192.168.20.252 24
[sw5-Vlanif20]int vlan 30
[sw5-Vlanif30]ip add 192.168.30.252 24
[sw5-Vlanif30]int vlan 40
[sw5-Vlanif40]ip add 192.168.40.252 24
<sw6>sys
Enter system view, return user view with Ctrl+Z.
[sw6]int vlan 10
[sw6-Vlanif10]ip add 192.168.10.253 24
[sw6-Vlanif10]int vlan 20
[sw6-Vlanif20]ip add 192.168.20.253 24
[sw6-Vlanif20]int vlan 30
[sw6-Vlanif30]ip add 192.168.30.253 24
[sw6-Vlanif30]int vlan 40
[sw6-Vlanif40]ip add 192.168.40.253 24
然后检测同网段是否可以互通,如果不通,检查
ip地址
是否所有交换机创建所有vlan
pc连接交换机接口的链路是否加入到对应vlan,交换机与交换机之间的链路是否为trunk
PC>ping 192.168.10.253
Ping 192.168.10.253: 32 data bytes, Press Ctrl_C to break
From 192.168.10.253: bytes=32 seq=1 ttl=255 time=93 msPC>ping 192.168.10.253
Ping 192.168.10.253: 32 data bytes, Press Ctrl_C to break
From 192.168.10.253: bytes=32 seq=1 ttl=255 time=93 ms
PC>ping 192.168.10.253
Ping 192.168.10.253: 32 data bytes, Press Ctrl_C to break
From 192.168.10.253: bytes=32 seq=1 ttl=255 time=93 ms
步骤6配置vrrp
sw5 vlan10 20 主 vlan30 40 备
sw6 vlan30 40 主 vlan10 20 备
[sw5]int vlan 10
[sw5-Vlanif10]vrrp vrid 10 virtu
[sw5-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[sw5-Vlanif10]vrrp vrid 10 pri
[sw5-Vlanif10]vrrp vrid 10 priority 105
[sw5-Vlanif10]int vlan 20
[sw5-Vlanif20]vrrp vrid 20 vir
[sw5-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[sw5-Vlanif20]vrrp vrid 20 priority 105
[sw5-Vlanif20]int vlan 30
[sw5-Vlanif30]vrrp vrid 30 virt
[sw5-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[sw5-Vlanif30]int vlan 40
[sw5-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
Enter system view, return user view with Ctrl+Z.
[sw6]int vlan 10
[sw6-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[sw6-Vlanif10]int vlan 20
[sw6-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[sw6-Vlanif20]int vlan 30
[sw6-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[sw6-Vlanif30]vrrp vrid 30 pri
[sw6-Vlanif30]vrrp vrid 30 priority 105
[sw6-Vlanif30]int vlan 40
[sw6-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[sw6-Vlanif40]vrrp vrid 40 priority 105
display vrrp brief 检查vrrp配置,两主两备
[sw5-Vlanif40]display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Master Vlanif10 Normal 192.168.10.254
20 Master Vlanif20 Normal 192.168.20.254
30 Backup Vlanif30 Normal 192.168.30.254
40 Backup Vlanif40 Normal 192.168.40.254
[sw5-Vlanif40]ping 192.168.40.1
PING 192.168.40.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.40.1: bytes=56 Sequence=1 ttl=128 time=80 ms
路由器
[Huawei]sys r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.50.1 24
sw5交换机配置vlan50 ,ip192.168.50.2
[sw5]int vlan 50
[sw5-Vlanif50]ip add 192.168.50.2 24
[sw5-Vlanif50]int g0/0/7
[sw5-GigabitEthernet0/0/7]port link-type access
[sw5-GigabitEthernet0/0/7]port default vlan 50
sw5交换机配置vlan70 ,ip192.168.70.2
[sw5]vlan batch 70 80
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw5]int vlan 70
[sw5-Vlanif70]ip add 192.168.70.2 24
[sw5-Vlanif70]int g0/0/8
[sw5-GigabitEthernet0/0/8]port link-type access
[sw5-GigabitEthernet0/0/8]port default vlan 70
sw6交换机配置vlan60 ,ip192.168.60.2
[sw5]int vlan 60
[sw5-Vlanif50]ip add 192.168.60.2 24
[sw5-Vlanif50]int g0/0/7
[sw5-GigabitEthernet0/0/7]port link-type access
[sw5-GigabitEthernet0/0/7]port default vlan 60
sw6交换机配置vlan80 ,ip192.168.80.2
[sw6]vlan batch 70 80
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw6]int vlan 80
[sw6-Vlanif80]ip add 192.168.80.2 24
[sw6-Vlanif80]int g0/0/8
[sw6-GigabitEthernet0/0/8]port link-type access
[sw6-GigabitEthernet0/0/8]port default vlan 80
ping命令测试是否同网段连接成功
[sw6]ping 192.168.60.1
PING 192.168.60.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.60.1: bytes=56 Sequence=1 ttl=255 time=60 ms
[sw6]ping 192.168.80.1
PING 192.168.80.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.80.1: bytes=56 Sequence=1 ttl=255 time=60 ms
[sw5]ping 192.168.50.1
PING 192.168.50.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.50.1: bytes=56 Sequence=1 ttl=255 time=80 ms
[sw5]ping 192.168.70.1
PING 192.168.70.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.70.1: bytes=56 Sequence=1 ttl=255 time=50 ms
动态路由宣告
[sw5]ospf
[sw5-ospf-1]area 0
[sw5-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.255
[sw5-ospf-1-area-0.0.0.0]network 192.168.70.0 0.0.0.255
[sw6]ospf
[sw6-ospf-1]area 0
[sw6-ospf-1-area-0.0.0.0]
[sw6-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.60.0 0.0.0.255
[sw6-ospf-1-area-0.0.0.0]network 192.168.80.0 0.0.0.255
路由器
[r1]ospf
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.60.0 0.0.0.255
[r2]ospf
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.70.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.80.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]
ping命令测试
<r1>ping 192.168.10.1
PING 192.168.10.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.10.1: bytes=56 Sequence=1 ttl=126 time=110 ms
<r1>ping 192.168.40.2
PING 192.168.40.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.40.2: bytes=56 Sequence=1 ttl=127 time=120 ms
display ip routing-table
路由器配置ip
[r2]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 100.0.0.2 8
[r1]int g0/0/2
[r1-GigabitEthernet0/0/2]ip ad 100.0.0.01 8
配置外网设备
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]undo inf en
Info: Information center is disabled.
[Huawei]int vlan 1
[Huawei-Vlanif1]ip add 100.0.0.10 8
目前无法访问外网100.0.0.10
标签:int,0.0,vlan,192.168,网络拓扑,大型,sw5,sw6 From: https://www.cnblogs.com/dyh6/p/17744580.html