单臂路由应用实例
一、拓扑图
1、拓扑图
2、要求
①、PC自动获取IP可以访问内网网页和外网的网页
②、利用VLAN隔绝广播域,且不同VLAN可以互相通信
二、配置交换机
1、创建Trunk链路
①、不同交换机具体如下
SW1:configure terminal
interface f0/3
switchport mode trunk
exit
SW2:configure terminal
interface range f0/3-5
switchport mode trunk
exit
SW3:configure terminal
interface f0/3
switchport mode trunk
exit
关闭: interface f0/x
no switchport mode trunk
exit
2、vtp domain命令
①、vtp domain 用于创建、删除、修改VLAN
vtp domain monkey
vlan 10
exit
vlan 20
exit
vlan 30
exit
vlan 40
exit
3、接口划分VLAN
①、不同交换机具体操作如下
SW1:configure terminal
interface f0/1
switchport access vlan 10
exit
interface f0/2
switchport access vlan 20
SW2:configure terminal
interface f0/1
switchport access vlan 10
exit
interface f0/2
switchport access vlan30
SW3:configure terminal
interface f0/1
switchport access vlan 20
exit
interface f0/2
switchport access vlan 40
三、配置路由器
1、路由器当DHCP服务器
①、设置子接口
configure terminal
interface f0/0.1
encapsulation dot1q 10 //对应VLAN10
ip address 123.0.0.254 255.255.255.0 //设置子接口IP
no shutdown
exit
interface f0/0.2
encapsulation dot1q 20 //对应VLAN20
ip address 124.0.0.254 255.255.255.0 //设置子接口IP
no shutdown
exit
interface f0/0.3
encapsulation dot1q 30 //对应VLAN30
ip address 125.0.0.254 255.255.255.0 //设置子接口IP
no shutdown
exit
interface f0/0.4
encapsulation dot1q 40 //对应VLAN40
ip address 126.0.0.254 255.255.255.0 //设置子接口IP
no shutdown
exit
②、部署DHCP
configure terminal
ip dhcp excluded-address 123.0.0.1 123.0.0.99 //排除IP的范围
ip dhcp pool v10 //设置不同的地址池
network 123.0.0.0 255.255.255.0
default-router 123.0.0.254
dns-server 126.0.0.1
exit
ip dhcp excluded-address 124.0.0.1 124.0.0.99 //排除IP的范围
ip dhcp pool v20 //设置不同的地址池
network 124.0.0.0 255.255.255.0
default-router 124.0.0.254
dns-server 126.0.0.1
exit
ip dhcp excluded-address 125.0.0.1 125.0.0.99 //排除IP的范围
ip dhcp pool v30 //设置不同的地址池
network 125.0.0.0 255.255.255.0
default-router 125.0.0.254
dns-server 126.0.0.1
exit
③、设置DNS服务器,并打开
2、DHCP服务器中继
①、服务器上添加DHCP服务器
②、路由器设置
configure terminal
interface f0/0.1
ip helper-address 126.0.0.1
exit
interface f0/0.2
ip helper-address 126.0.0.1
exit
interface f0/0.3
ip helper-address 126.0.0.1
exit
3、内网路由与外网路由设置
①、注意不要随意使用路由默认,容易导致路由环路
内网路由:configure terminal
ip route 0.0.0.0 0.0.0.0 202.0.0.2
外网路由:configure terminal
ip route 123.0.0.0 255.255.255.0 202.0.0.1
ip route 124.0.0.0 255.255.255.0 202.0.0.1
ip route 125.0.0.0 255.255.255.0 202.0.0.1
ip route 126.0.0.0 255.255.255.0 202.0.0.1