2019.4.26学习笔记(路由器router-2)
三台pc,三台路由器,一台交换机连接设置(静动态)
拓扑如图这么连接,进行设置
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。静态设置
设置 三台pc的ip分别为:
- pc0 192.168.1.1
- pc1 192.168.3.2
- pc2 192.168.4.2
子网掩码都是:255.255.255.0
默认网关(default Gateway)分别是:
- 192.168.1.2
- 192.168.3.1
- 192.168.4.1
设置第一台路由器:
enable
configure terminal
int f0/0
no shutdown
ip address 192.168.1.2 255.255.255.0
exit
int f0/1
no shutdown
ip address 192.168.2.1 255.255.255.0
exit
ip route 192.168.3.0 255.255.255.0 192.168.2.2 (fastEthernet 0/1)
ip route 目标网络 掩码 下一跳地址(接口) 下一跳地址好,接口的话,如果pc变多,会产生很多arp缓存记录,路由器接口内存耗尽。
ip route 192.168.4.0 255.255.255.0 192.168.2.3 (fastEthernet 0/1)
设置第二台路由器:
enable
configure terminal
int f0/0
no shutdown
ip address 192.168.2.2 255.255.255.0
exit
int f0/1
no shutdown
ip address 192.168.3.1 255.255.255.0
exit
ip route 192.168.1.0 255.255.255.0 192.168.2.1 (fastEthernet 0/0)
ip route 192.168.4.0 255.255.255.0 192.168.2.3 (fastEthernet 0/0)
第三台路由器设置:
enable
configure terminal
int f0/0
no shutdown
ip address 192.168.2.3 255.255.255.0
exit
int f0/1
no shutdown
ip address 192.168.4.1 255.255.255.0
exit
ip route 192.168.1.0 255.255.255.0 192.168.2.1 (fastEthernet 0/0)
ip route 192.168.3.0 255.255.255.0 192.168.2.2 (fastEthernet 0/0)
通过ping命令查看是否联通
动态设置:
三台电脑ip,子网掩码,网关都跟上面一样。
第一台路由器设置:
enable
configure terminal
int f0/0
no shutdown
ip address 192.168.1.2 255.255.255.0
exit
int f0/1
no shutdown
ip address 192.168.2.1 255.255.255.0
exit
router rip(启动rip路由协议)rou r
network 192.168.1.0
network 192.168.2.0
第二台路由器设置:
enable
configure terminal
int f0/0
no shutdown
ip address 192.168.2.2 255.255.255.0
exit
int f0/1
no shutdown
ip address 192.168.3.1 255.255.255.0
exit
rou r
network 192.168.2.0
network 192.168.3.0
第三台路由器设置:
enable
configure terminal
int f0/0
no shutdown
ip address 192.168.2.3 255.255.255.0
exit
int f0/1
no shutdown
ip address 192.168.4.1 255.255.255.0
exit
rou r
network 192.168.4.0
network 192.168.2.0
设置完毕。
通过ping命令查看是否联通
