要求:
1.全网可达
2.拓扑中所需地址全部基于192.168.1.0/24
3.静态路由
4.R2需要环回汇总
拓扑图:
根据要求需要在192.168.1.0/24这个网段下配置IP,所以我们首先划分子网.然后分配ip
各个路由器的配置:
AR1
sysname r1(修改名字)
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.248
interface GigabitEthernet0/0/1
ip address 192.168.1.25 255.255.255.248
缺省路由
ip route-static 0.0.0.0 0.0.0.0 192.168.1.26
ip route-static 192.168.1.0 255.255.255.128 NULL0(空接口,防止路由黑洞)
静态路由的配置:
ip route-static 192.168.1.8 255.255.255.248 192.168.1.2
ip route-static 192.168.1.16 255.255.255.248 192.168.1.26
ip route-static 192.168.1.32 255.255.255.248 192.168.1.26
ip route-static 192.168.1.40 255.255.255.248 192.168.1.26
ip route-static 192.168.1.48 255.255.255.248 192.168.1.26
ip route-static 192.168.1.56 255.255.255.248 192.168.1.2
ip route-static 192.168.1.56 255.255.255.248 192.168.1.26
ip route-static 192.168.1.64 255.255.255.192 192.168.1.2
ip route-static 192.168.1.64 255.255.255.248 192.168.1.2
ip route-static 192.168.1.64 255.255.255.248 192.168.1.26
AR2
sysname r2
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.248
interface GigabitEthernet0/0/1
ip address 192.168.1.9 255.255.255.248
配置虚拟接口
interface LoopBack1
ip address 192.168.1.73 255.255.255.248
interface LoopBack2
ip address 192.168.1.81 255.255.255.248
interface LoopBack3
ip address 192.168.1.89 255.255.255.248
缺省路由
ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
ip route-static 192.168.1.0 255.255.255.128 NULL0(设置空接口防止路由黑洞)
静态路由的配置:
ip route-static 192.168.1.16 255.255.255.248 192.168.1.10
ip route-static 192.168.1.24 255.255.255.248 192.168.1.1
ip route-static 192.168.1.32 255.255.255.248 192.168.1.1
ip route-static 192.168.1.32 255.255.255.248 192.168.1.10
ip route-static 192.168.1.40 255.255.255.248 192.168.1.1
ip route-static 192.168.1.40 255.255.255.248 192.168.1.10
ip route-static 192.168.1.48 255.255.255.248 192.168.1.1
ip route-static 192.168.1.48 255.255.255.248 192.168.1.10
ip route-static 192.168.1.56 255.255.255.248 192.168.1.10
ip route-static 192.168.1.64 255.255.255.248 192.168.1.10
AR3
sysname r3
dhcp enable(开启DHCP服务:通过该协议给pc机自动获取IP)
ip pool 2
gateway-list 192.168.1.57
network 192.168.1.56 mask 255.255.255.248
dns-list 114.114.114.114 8.8.8.8
ip pool 3
gateway-list 192.168.1.65
network 192.168.1.64 mask 255.255.255.248
dns-list 114.114.114.114 8.8.8.8
在接口处再次确定DHCP协议
interface GigabitEthernet0/0/2.1
arp broadcast enable
dhcp select global
interface GigabitEthernet0/0/2.2
arp broadcast enable
dhcp select global
interface GigabitEthernet0/0/0
ip address 192.168.1.10 255.255.255.248
interface GigabitEthernet0/0/1
ip address 192.168.1.17 255.255.255.248
单臂路由
interface GigabitEthernet0/0/2.1(创建虚拟子接口)
dot1q termination vid 2(划分归属vlan)
ip address 192.168.1.57 255.255.255.248
arp broadcast enable
dhcp select global
interface GigabitEthernet0/0/2.2(创建虚拟子接口)
dot1q termination vid 3(划分归属vlan)
ip address 192.168.1.65 255.255.255.248
arp broadcast enable
dhcp select global
静态路由
ip route-static 0.0.0.0 0.0.0.0 192.168.1.18(缺省路由)
ip route-static 192.168.1.0 255.255.255.128 NULL0(空接口)
ip route-static 192.168.1.0 255.255.255.248 192.168.1.9
ip route-static 192.168.1.24 255.255.255.248 192.168.1.18
ip route-static 192.168.1.32 255.255.255.248 192.168.1.18
ip route-static 192.168.1.40 255.255.255.248 192.168.1.18
ip route-static 192.168.1.48 255.255.255.248 192.168.1.18
ip route-static 192.168.1.64 255.255.255.192 192.168.1.9
AR4
sysname r4
interface GigabitEthernet0/0/0
ip address 192.168.1.26 255.255.255.248
interface GigabitEthernet0/0/1
ip address 192.168.1.18 255.255.255.248
interface GigabitEthernet0/0/2
ip address 192.168.1.41 255.255.255.248
interface GigabitEthernet4/0/0
ip address 192.168.1.33 255.255.255.248
静态路由
ip route-static 0.0.0.0 0.0.0.0 192.168.1.34(缺省路由)
ip route-static 0.0.0.0 0.0.0.0 192.168.1.40(缺省路由)
ip route-static 192.168.1.0 255.255.255.128 NULL0(空接口)
ip route-static 192.168.1.0 255.255.255.248 192.168.1.25
ip route-static 192.168.1.8 255.255.255.248 192.168.1.17
ip route-static 192.168.1.48 255.255.255.248 192.168.1.34
ip route-static 192.168.1.48 255.255.255.248 192.168.1.42
ip route-static 192.168.1.56 255.255.255.248 192.168.1.17
ip route-static 192.168.1.64 255.255.255.192 192.168.1.25
ip route-static 192.168.1.64 255.255.255.192 192.168.1.17
ip route-static 192.168.1.64 255.255.255.248 192.168.1.17
AR5
sysname r5
interface GigabitEthernet0/0/0
ip address 192.168.1.42 255.255.255.248
interface GigabitEthernet0/0/1
ip address 192.168.1.34 255.255.255.248
interface GigabitEthernet0/0/2
ip address 192.168.1.49 255.255.255.248
静态路由
ip route-static 0.0.0.0 0.0.0.0 192.168.1.50
ip route-static 192.168.1.0 255.255.255.128 192.168.1.33
ip route-static 192.168.1.0 255.255.255.128 192.168.1.41
ip route-static 192.168.1.0 255.255.255.128 NULL0
ISP(运营商)
sysname ISP
interface GigabitEthernet0/0/0
ip address 192.168.1.50 255.255.255.248
interface LoopBack0
ip address 100.1.1.1 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 192.168.1.49(缺省路由)
SW1
sysname sw1
vlan batch 2 to 3(创建vlan)
打开trunk干道
interface Ethernet0/0/1
port link-type trunkV
port trunk allow-pass vlan 2 to 3
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
分配vlan
interface Ethernet0/0/3
port link-type access
port default vlan 2
interface Ethernet0/0/4
port link-type access
port default vlan 3
SW2
sysname sw2
创建vlan
vlan batch 2 to 3
打开trunk干道
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
分配vlan
interface Ethernet0/0/2
port link-type access
port default vlan 2
interface Ethernet0/0/3
port link-type access
port default vlan 3
结果:
pc1
pc1 ping ISP
pc1 ping AR1