单臂路由实验配置

单臂路由实验配置

Sw1:
[sw1]vlan 2
[sw1-vlan2]q //创建vlan
[sw1]vlan 3

[sw1]vlan batch 4 to 10 //批量创建vlan
[sw1]undo vlan batch 4 to 10 //删除vlan

[sw1]interface e0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2 //将端口Ethernet0/0/1划分到vlan2

[sw1]interface e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 3 //将端口Ethernet0/0/2划分到vlan3

Sw2:
[sw2]vlan batch 2 to 3
[sw2]interface e0/0/1 //创建vlan
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 2 //将端口Ethernet0/0/1划分到vlan2
[sw2]interface e0/0/2
[sw2-Ethernet0/0/2]port default vlan 3

在两台交换机上进行trunk配置:
Sw1:
[sw1]interface e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk //trunk端口设置
[sw1-Ethernet0/0/3]port trunk allow-pass vlan all //允许通过的vlan
Sw2:
[sw2]interface e0/0/3
[sw2-Ethernet0/0/3]port link-type trunk //trunk端口设置
[sw2-Ethernet0/0/3]port trunk allow-pass vlan all //允许通过的vlan

单臂路由配置:
[r1]interface g0/0/0.1 //创建虚拟子接口
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 24 //网关地址配置
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2 //终止子接口用于vlan 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable //启用arp的广播功能
[r1]interface g0/0/0.2 //创建虚拟子接口
[r1-GigabitEthernet0/0/0.2]ip address 192.168.2.1 24 //网关地址配置
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3 //终止子接口用于vlan 3
[r1-GigabitEthernet0/0/0.2]arp broadcast enable //启用arp的广播功能
查看虚拟子接口配置:
[r1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 3
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned up down
GigabitEthernet0/0/0.1 192.168.1.1/24 up up
GigabitEthernet0/0/0.2 192.168.2.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned
交换机上进行trunk配置:
[sw1]interface e0/0/4
[sw1-Ethernet0/0/4]port link-type trunk
[sw1-Ethernet0/0/4]port trunk allow-pass vlan all
DHCP配置:
[r1]ip pool class_A //创建地址池class_A
Info: It’s successful to create an IP address pool.
[r1-ip-pool-class_A]network 192.168.1.0 mask 24 //所要下放的地址
[r1-ip-pool-class_A]gateway-list 192.168.1.1 //网关地址
[r1-ip-pool-class_A]dns-list 8.8.8.8 //DNS服务器地址
[r1]dhcp enable //启用dhcp服务器
Info: The operation may take a few seconds. Please wait for a moment.done.
[r1]interface g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global //dhcp的调用
[r1]ip pool class_B //创建地址池class_B
Info: It’s successful to create an IP address pool.
[r1-ip-pool-class_B]network 192.168.2.0 mask 24 //所要下放的地址
[r1-ip-pool-class_B]gateway-list 192.168.2.1 //网关地址
[r1-ip-pool-class_B]dns-list 8.8.8.8 //DNS服务器地址
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global //dhcp的调用
查看PC获取的IP地址:
Vlan 2 PC获取的IP地址:
PC 1: PC3:
PC>ipconfig PC>ipconfig
Link local IPv6 address…: fe80::5689:98ff:feaa:2f36 Link local IPv6 address…: fe80::5689:98ff:fee1:375f
IPv6 address…: :: / 128 IPv6 address…: :: / 128
IPv6 gateway…: :: IPv6 gateway…: ::
IPv4 address…: 192.168.1.254 IPv4 address…: 192.168.1.253
Subnet mask…: 255.255.255.0 Subnet mask…: 255.255.255.0
Gateway…: 192.168.1.1 Gateway…: 192.168.1.1
Physical address…: 54-89-98-AA-2F-36 Physical address…: 54-89-98-E1-37-5F
DNS server…: 8.8.8.8 DNS server…: 8.8.8.8
Vlan 2 PC获取的IP地址:
PC2: PC4:
PC>ipconfig PC>ipconfig
Link local IPv6 address…: fe80::5689:98ff:feb7:3631 Link local IPv6 address…: fe80::5689:98ff:fe07:5a48
IPv6 address…: :: / 128 IPv6 address…: :: / 128
IPv6 gateway…: :: IPv6 gateway…: ::
IPv4 address…: 192.168.2.254 IPv4 address…: 192.168.2.253
Subnet mask…: 255.255.255.0 Subnet mask…: 255.255.255.0
Gateway…: 192.168.2.1 Gateway…: 192.168.2.1
Physical address…: 54-89-98-B7-36-31 Physical address…: 54-89-98-07-5A-48
DNS server…: 8.8.8.8 DNS server…: 8.8.8.8
禁用IP地址:
[r1]ip pool class_B
[r1-ip-pool-class_B]excluded-ip-address 192.168.2.200 192.168.2.254

上一篇:跨交换机实现 VLAN 间路由


下一篇:园区网络布局(VRRP+MSTP)(使用ensp)