拓扑图:
rip 是应用层的,UDP 的,端口号是520
1 、在PC上加网段路由
192.168.10.0 下一跳 10.230.83.X
2 、在PC 上加主机路由
192.168.10.10 下一跳 10.230.83.X
3 、在PC上加主机路由且永久生效 (- p)
4 、删除永久生效的路由
5 、制作一个BAT批处理文件(一个就是增加,另一个就是删除)
1 <1 毫秒 <1 毫秒 <1 毫秒 10.230.83.1
2 <1 毫秒 2 ms 1 ms 192.168.8.186
3 <1 毫秒 <1 毫秒 <1 毫秒 192.168.8.189
4 <1 毫秒 <1 毫秒 <1 毫秒 10.230.83.1
5 <1 毫秒 2 ms 1 ms 192.168.8.186
6 <1 毫秒 <1 毫秒 <1 毫秒 192.168.8.189
水平分割;我从这个接口收到的这条路由,不会再从这个接口发送出去
rip ver 1 版
广播更新,不能识别子网掩码,只能识别A B C 这种主类网络
rip ver 2 版
组播更新,224.0.0.9 ,可以识别VLSM ,可以识别变长的子网掩码。
rip 进程号
ver 2 //设置为版本
network 直连的主网络号 // 让哪些接口运行该协议(这里要注意:rip的版本一定要相同,否则路由器之间ping不通)
AR1
rip 1
version 2
network 192.168.10.0 //只需要设置路由器的两端接口的网段
network 192.168.12.0
AR2
rip 1
version 2
network 192.168.12.0
network 192.168.23.0
AR3
rip 1
version 2
network 192.168.23.0
network 192.168.34.0
AR4
rip 1
version 2
network 192.168.34.0
network 192.168.40.0
设置成后,几个路由器之间是可以ping通的,但是无法ping通交换机的那端
display rip 1 interface ver //查看接口上玩完整的rip协议,可以看到水平分割
display rip 1 route //查看rip 路由
display ip routing-table protocol rip //查看路由表中关于rip路由协议
display rip //可以查看更新协议
update time :30 sec age time :180 sec
设置交换机
命令:
R1
int g0/0/1
ip add 192.168.10.0 24
quit
rip 1
undo network 192.168.10.0
net 192.168.7.0
quit
SW1
undo ip route-st 0.0.0.0 0.0.0.0 192.168.10.1
vlan 2
desc IT
vlan 3
desc sales
vlan 4
desc DEV
vlan 5
desc fin
quit
int vlan 1
ip add 192.168.7.2 29
int vlan 2
ip add 192.168.8.254 24
int vlan 3
ip add 192.168.9.254 24
int vlan 4
ip add 192.168.10.254 24
int vlan 5
ip add 192.168.11.254 24
quit
ip route-st 0.0.0.0 0.0.0.0 192.168.7.1 desc internet-route
int g0/0/23
port link-ty access
port default vlan 2
int g0/0/24
port link-ty access
port default vlan 3
绑定静态IP:
R1
int g0/0/1
ip add 192.168.7.1 29
quit
rip 1
undo network 192.168.10.0
net 192.168.7.0
quit
SW1
undo ip route-st 0.0.0.0 0.0.0.0 192.168.10.1
vlan 2
desc IT
vlan 3
desc sales
vlan 4
desc DEV
vlan 5
desc fin
quit
int vlan 1
ip add 192.168.7.2 29
int vlan 2
ip add 192.168.8.254 24
int vlan 3
ip add 192.168.9.254 24
int vlan 4
ip add 192.168.10.254 24
int vlan 5
ip add 192.168.11.254 24
quit
ip route-st 0.0.0.0 0.0.0.0 192.168.7.1 desc internet-route
int g0/0/23
port link-ty access
port default vlan 2
int g0/0/24
port link-ty access
port default vlan 3
======================================
DHCP 动态主机地址分配置协议
服务器,一般就设置成静态的
DHCP发的是4次广播包
vlan 2 --192.168.8.0 地址 192.168.8.1 --8.254
8.1---8.29 (预留)
8.241-254 (预留)
8.30--8.240 (分配给别人)
掩码
网关
DNS :将域名解析成IP地址
step 1
dhcp enable //启用DHCP功能
step 2
ip pool a //创建一个池,名字叫a
network 192.168.8.0 mask 255.255.255.0
excluded-ip-address 192.168.8.1 192.168.8.29 //排除地址
excluded-ip-address 192.168.8.241 192.168.8.253 //排除地址
dns-list 8.8.8.8 114.114.114.114 //指定DNS服务器
gateway-list 192.168.8.254 //指定网关,一定是SVI接口的IP(是vlan几的就是那个的vlan的IP地址)
static-bind ip-address 192.168.8.88 mac-address 5489-9832-6db5 //静态绑定,这个mac地址永远拿这个IP地址
quit
step 3
int vlan 2
dhcp select global //调用DHCP全局配置
在虚拟机的真机上要动态获取IP,需要将虚拟机的网络设置成动态,并且将在dos界面输入下面的命令
ipconfig/release
ipconfig/renew
====================
ip pool B
network 192.168.9.0 mask 255.255.255.0
excluded-ip-address 192.168.9.1 192.168.9.29
excluded-ip-address 192.168.9.241 192.168.9.253
gateway-list 192.168.9.254
dns-list 8.8.8.8 114.114.114.114
display ip pool name vlan1_pool used //查看已分配的地址
reset ip pool name vlan1_pool used //清除已分配置的IP地址,用户视图下