目录
实验结构拓扑图:
实验要求:
实验思路:
实验具体过程:
R1相关配置命令如下:
R2相关配置命令如下:
R3相关配置命令如下:
R4相关配置命令如下:
R5相关配置命令如下:
R6相关配置命令如下:
交换机1相关配置命令:
交换机2相关配置命令:
实验命令截图:
R1:
R2:
R3:
R4:
R5:
R6:
实验结果图:
1:根据网段192.168.1.0/24划分子网
2:使用静态路由(不准使用动态路由协议)
3:划分vlan,使用单臂路由管理
4:全网可达、避免环路
1:ip地址规划,根据主干道及环回接口个数划分4个子网
2:去交换机上划分vlan、开trunk干道
3:给路由器接口配置ip、环回接口、单臂路由
4:给R1-R6写路由表,在R1-R4还要加上指向R6的缺省路由(也可以写静态路由),在R4和R5上面加上空接口防环
5:实验完毕,进行测试
#
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.13 255.255.255.252
#
interface LoopBack1 //环回接口1
ip address 192.168.1.65 255.255.255.240
#
interface LoopBack2 //换回接口2
ip address 192.168.1.81 255.255.255.240
#
interface LoopBack3 //环回接口3
ip address 192.168.1.97 255.255.255.240
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.2 //缺省路由,目的在于不使用直达的静态路由访问
ip route-static 0.0.0.0 0.0.0.0 192.168.1.14 //等开销负载均衡
ip route-static 192.168.1.4 255.255.255.252 192.168.1.2
ip route-static 192.168.1.8 255.255.255.252 192.168.1.14
ip route-static 192.168.1.16 255.255.255.252 192.168.1.14
#
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.6 255.255.255.252
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.5 //指向R6网段的缺省路由
ip route-static 192.168.1.8 255.255.255.252 192.168.1.5
ip route-static 192.168.1.12 255.255.255.252 192.168.1.1
ip route-static 192.168.1.16 255.255.255.252 192.168.1.5
ip route-static 192.168.1.20 255.255.255.252 192.168.1.5
ip route-static 192.168.1.64 255.255.255.192 192.168.1.1
ip route-static 192.168.1.128 255.255.255.192 192.168.1.5
ip route-static 192.168.1.128 255.255.255.192 192.168.1.1
#
#
interface GigabitEthernet0/0/0
ip address 192.168.1.14 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.9 255.255.255.252
#
dhcp enable //开启dhcp服务
#
ip pool a //创建ip池塘
gateway-list 192.168.1.129
network 192.168.1.128 mask 255.255.255.224
dns-list 114.114.114.114
#
ip pool b
gateway-list 192.168.1.161
network 192.168.1.160 mask 255.255.255.224
dns-list 114.114.114.114
#
interface GigabitEthernet0/0/2.1 //单臂路由,划分子接口,管理vlan 2
dot1q termination vid 2
ip address 192.168.1.129 255.255.255.224
arp broadcast enable //开启arp服务
dhcp select global
#
interface GigabitEthernet0/0/2.2
dot1q termination vid 3
ip address 192.168.1.161 255.255.255.224
arp broadcast enable
dhcp select global
#
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
ip route-static 192.168.1.0 255.255.255.252 192.168.1.13
ip route-static 192.168.1.4 255.255.255.252 192.168.1.10
ip route-static 192.168.1.16 255.255.255.252 192.168.1.10
ip route-static 192.168.1.20 255.255.255.252 192.168.1.10
ip route-static 192.168.1.64 255.255.255.192 192.168.1.13
#
#
interface GigabitEthernet0/0/0
ip address 192.168.1.5 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.10 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 192.168.1.17 255.255.255.252
#
interface GigabitEthernet4/0/0
ip address 192.168.1.21 255.255.255.252
#
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
ip route-static 0.0.0.0 0.0.0.0 192.168.1.22
ip route-static 192.168.1.0 255.255.255.0 NULL 0 //空接口,防环
ip route-static 192.168.1.0 255.255.255.252 192.168.1.6
ip route-static 192.168.1.12 255.255.255.252 192.168.1.9
ip route-static 192.168.1.64 255.255.255.192 192.168.1.9
ip route-static 192.168.1.64 255.255.255.192 192.168.1.6
ip route-static 192.168.1.128 255.255.255.192 192.168.1.9
#
#
interface GigabitEthernet0/0/0
ip address 192.168.1.18 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 100.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.1.22 255.255.255.252
#
ip route-static 192.168.1.0 255.255.255.0 192.168.1.17
ip route-static 192.168.1.0 255.255.255.0 192.168.1.21 preference 70 //修改preference值,起备份作用,又叫漂浮路由
#
#
interface GigabitEthernet0/0/0
ip address 100.1.1.2 255.255.255.0
#
ip route-static 192.168.1.0 255.255.255.0 100.1.1.1
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
interface Ethernet0/0/3
port link-type access
port default vlan 2
#
interface Ethernet0/0/4
port link-type access
port default vlan 3
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
interface Ethernet0/0/2
port link-type access
port default vlan 2
#
interface Ethernet0/0/3
port link-type access
port default vlan 3
#
麻烦大家看完后点个赞,谢谢啦!